#include using std::cin; using std::cout; int main() { int a, b; cin >> a >> b; if ((a - 1) / 2 == (b - 1) / 2 and (a % 2 == 1 or b % 2 == 1)) puts("Q"); else puts("P"); return 0; }