#include using namespace std; using ll=long long; #define rep(i,n) for(int i=0;i=0;i--) #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() template bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;} template bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;} void solve(ll N){ if(N%2==1){ cout<<"K\n"; }else{ if(N==2){ cout<<"P\n"; }else{ for(int p=2;;p++){ if(gcd(p,N)==1){ for(int q=2;q1&&N%q!=0){ cout<<"P\n"; return; } } cout<<"K\n"; return; } } } } } int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int T; cin>>T; while(T--){ ll N; cin>>N; solve(N); } }