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