A,B = map(int,input().split()) if A == B: if A % 2 == 1: print ("Q") else: print ("P") elif abs(A-B) == 1: if min(A,B) % 2 == 1: print ("Q") else: print ("P") else: print ("P")