## https://yukicoder.me/problems/no/955 def solve(a, b, first): if a == 1 or b == 1: return 1 - first k = a // 2 k_ = b // 2 k = min(k_, k) a -= k * 2 b -= k * 2 if a == 0 or b == 0: a += 2 b += 2 turn = first while a > 1 and b > 1: if a > b: a -= 2 else: b -= 2 turn = 1 - turn return 1 - turn def main(): a, b = map(int, input().split()) if abs(a - b) == 1: result = solve(a, b, 0) if result == 0: print("P") else: print("Q") else: if a == 1 or b == 1: print("P") return if a > b: res = solve(b + 1, b, 1) res2 = solve(b - 1, b, 1) if res == 0 or res2 == 0: print("P") else: print("Q") elif a < b: res = solve(a + 1, a, 1) res2 = solve(a - 1, a, 1) if res == 0 or res2 == 0: print("P") else: print("Q") else: # a == b res = solve(a - 1, b, 1) if res == 0: print("P") else: print("Q") if __name__ == '__main__': main()