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