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