a, b = map(int, input().split()) a -= 1 b -= 1 if a // 2 == b // 2 and (a % 2 == 0 or b % 2 == 0): print("Q") else: print("P")