a,b=map(int,input().split()) if abs(a-b)<=1 and min(a,b)%2==1: print("Q") else: print("P")