#include long long gcd(long long a, long long b) { if (a == 0) return b; else return gcd(b % a, a); } int solve(long long N) { if (N == 2) return 0; int i; for (i = 2; N % i == 0; i++); if (gcd(i, N) != 1) return 0; else return 1; } int main() { int T; long long N; scanf("%d", &T); while (T--) { scanf("%lld", &N); if (solve(N) != 0) printf("K\n"); else printf("P\n"); } fflush(stdout); return 0; }