#include #define rep(i,n) for(int i=0;i<(n);++i) using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin>>t; while(t--){ ll n; cin>>n; if(n==2){ cout << "P" << endl; continue; } ll x = n; for(int i=2;i<=100;i++){ if(x%i!=0){ if(gcd(n,i)==1){ cout << "K" << endl; } else{ cout << "P" << endl; } break; } } } }