#include #include using namespace std; int pf[3<<20]; int cnt[3<<20]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); for(int i=2;i<3<<20;i++)if(pf[i]==0) { for(int j=i+i;j<3<<20;j+=i)pf[j]=i; } for(int i=2;i<3<<20;i++)cnt[i]=cnt[i-1]+!pf[i]; int T;cin>>T; for(;T--;) { int N;cin>>N; if(pf[N]==0)cout<<"P\n"; else { int t=N; t-=cnt[N]-cnt[N/2]; cout<<(t%2?"K\n":"P\n"); } } }