a, b = read_line.split.map(&.to_i) puts ((a - b).abs == 1 && {a, b}.min.odd?) || (a == b && a.odd?) ? "Q" : "P"