A, B = map(int, input().split()) A, B = min(A, B), max(A, B) if A % 2 == 0: print('P') else: if B in [A, A + 1]: print('Q') else: print('P')