#include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int Need = 100; vector>> Pf(Need+1); vector prime(Need+1,true); prime.at(0) = false; prime.at(1) = false; for(int i=2; i<=Need; i++){ if(!prime.at(i)) continue; Pf.at(i) = {{i,1}}; for(int k=i+i; k<=Need; k+=i){ prime.at(k) = false; int f = 0,k2 = k; while(k2%i == 0) f++,k2 /= i; Pf.at(k).push_back({i,f}); } } int T; cin >> T; while(T--){ long long N; cin >> N; if(N == 2){cout << "P" << endl; continue;} int first = -1; for(int i=2; i<=N; i++){ if(N%i == 0) continue; first = i; break; } int now = first,yes = 0,add = 1; for(auto [p,e] : Pf.at(now)) add *= p; while(now < N){ if(N%now){ int g = gcd(now,N); if(g == 1){yes = 1; break;} } now += add; } if(yes) cout << "K" << endl; else cout << "P" << endl; } }