#include #include using namespace std; using lint = long long; bool solve(lint N) { lint m = 2; while (N % m == 0) ++m; if (m >= N) return false; return std::gcd(m, N) == 1; } int main() { cin.tie(nullptr)->sync_with_stdio(false); int T; cin >> T; while (T--) { lint N; cin >> N; cout << (solve(N) ? "K" : "P") << '\n'; } }