a, b = sorted([int(a) for a in input().split()]) if a == b or (a % 2 and b == a + 1): print("Q") else: print("P")