A,B=map(int,input().split()) if A>B: A,B=B,A if abs(A-B)<=1 and A&1: print('Q') else: print('P')