#include using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int T, N, i, l, r, c, count; cin >> T; for (i = 0; i != T; ++i) { cin >> N; for (l = 1, r = 32; l + 1 < r; ) { c = (l + r) / 2; if (c * c <= N) l = c; else r = c; } if (l * l == N) cout << "P\n"; else cout << "K\n"; } return 0; }