#include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int T; cin >> T; while(T--){ long long N; cin >> N; if(N == 2){cout << "P" << endl; continue;} int first = -1,last = -1; for(int i=2; i<=N; i++){ if(N%i == 0) continue; if(last == -1) last = i; int g = gcd(N,i); if(g != 1) continue; first = i; break; } if(last == first) cout << "K" << endl; else{ int now = first*2,yes = 0; while(now <= N){ int g = gcd(N,now); if(g == 1){yes = 1; break;} now += first; } if(yes) cout << "K" << endl; else cout << "P" << endl; } } }