#include #define inf 1000000000ll using namespace std; using ll = long long; int main(){ int t; cin >> t; unordered_set st = {}; for(ll i = 1; i <= 1000000ll; ++i){ st.insert(i * i); } for(int i = 0; i < t; ++i){ ll n; cin >> n; if(st.find(n) != st.end()){ cout << 'P' << endl; } else{ cout << 'K' << endl; } } return 0; }