#include <bits/stdc++.h>
using namespace std;
int main(){
  int A, B;
  cin >> A >> B;
  if ((A - 1) / 2 == (B - 1) / 2 && (A % 2 == 1 || B % 2 == 1)){
    cout << 'Q' << endl;
  } else {
    cout << 'P' << endl;
  }
}