a, b = map(int, input().split()) if a > b: larger = a smaller = b else: larger = b smaller = a if larger - smaller == 1: print("Q") else: print("P")