a, b = map(int, input().split()) if a > b: a, b = b, a if a == 1 or a == 3 and b == 4 or a >= 5 and a == b: print("Q") else: print("P")