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