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