#include #include #include using namespace std; typedef long long LL; const LL mod=1e9+7; int main(){ LL n,m; cin>>n>>m; if(n>m){ n=m+1; } if(m>n){ m=n+1; } int t=n+m; if(t%2==0)t--; if((t/2)%2)puts("Q"); else puts("P"); return 0; }