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