A, B = map(int, input().split()) if min(A, B) % 2 == 0: print('P') else: if abs(A - B) <= 1: print('Q') else: print('P')