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