A,B = map(int,input().split()) P = 'P' Q = 'Q' if A == B: if A & 1: print(Q) else: print(P) else: if B == A + 1: if B % 2 == 0: print(Q) else: print(P) elif A == B + 1: if A % 2 == 0: print(Q) else: print(P) else: print(P)