#include using namespace std; int isqrt(int n){ int ok = 0; int ng = 32; while(abs(ok - ng) > 1){ int mid = (ok + ng) >> 1; if(mid * mid <= n){ ok = mid; } else{ ng = mid; } } return ok; } int main(){ int t; cin >> t; for(int i = 0; i < t; ++i){ int n; cin >> n; int k = isqrt(n); char ans = (k * k == n) ? 'P' : 'K'; cout << ans << endl; } return 0; }