#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  ll a,b;
  cin>>a>>b;
  
  if(a>b) swap(a,b);
  if(a%2==1 && (a==b || a+1==b)) cout<<'Q'<<endl;
  else cout<<'P'<<endl;
  
  return 0;
}