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