#include #include using namespace std; using namespace atcoder; //const long long INF = 1LL<<60; int main() { int t; cin >> t; for (int i=0; i < t; i++){ int n; cin >> n; if (n == (sqrt(n) * sqrt(n))) cout << "P" << endl; else cout << "K" << endl; } return 0; }