#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } // 50以下の素数 const vector primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47}; int main() { fast_io(); int t; cin >> t; for (; t--;) { long long n; cin >> n; for (long long p : primes) { if (n % p) { break; } while (n % p == 0) { n /= p; } } cout << (n > 1 ? "K" : "P") << "\n"; } }