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