a, b = map(int, input().split()) if a > b: a, b = b, a ans = 'PQ'[a + 1 == b and a % 2] print(ans)