#include #include #include using namespace std; using ll = long long; int N; void solve(){ cin >> N; vector p; for(int i = 1;i * i <= N;i++){ if(N % i != 0)continue; p.push_back(i); p.push_back(N / i); } sort(p.begin(), p.end()); p.erase(unique(p.begin(), p.end()), p.end()); cout << (p.size() % 2 ? "P\n" : "K\n"); } int main(void){ ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while(t--)solve(); return 0; }