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