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