//実験します。綺麗ですね。(間違ってたらすみません) #include using namespace std; int main() { int a, b; cin >> a >> b; a--; b--; if (a / 2 == b / 2 && (a % 2 == 1 || b % 2 == 1)) { cout << "Q" << endl; } else { cout << "P" << endl; } return 0; }