a, b = io.read("*n", "*n") if a < b then a, b = b, a end if a % 2 == 1 then print(a == b and "Q" or "P") else print(a == b + 1 and "Q" or "P") end