A,B = map(int,input().split()) if A > B: A,B = B,A if A % 2 == 1 and A + 1 >= B: print("Q") else: print("P")