A, B = map(int, input().split()) if A == B: print("Q") else: if (A + B) % 2 == 0: print("P") else: print("Q")