a, b = map(int, input().split()) if a == b and a % 2 == 1: print("Q") elif abs(a - b) == 1 and min(a, b) % 2 == 1: print("Q") else: print("P")