#include using namespace std; using ll = long long; char solve(ll n) { for (ll i = 2; i < n; ++i) { if (n % i == 0) { continue; } if (gcd(n, i) == 1) { return 'K'; } break; } return 'P'; } int main(void) { int t; cin >> t; vector query(t); for (auto& n : query) { cin >> n; } for (ll n : query) { cout << solve(n) << endl; } return 0; }