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