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