a, b = map(int, input().split()) if a % 2 == 1 and b in {a + 1, a}: print("Q") elif a % 2 == 0 and b == a - 1: print("Q") else: print("P")