#include using namespace std; template T gcd(T a, T b){return b==0?a:gcd(b,a%b);} int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int T; cin>>T; while(T--) { long N; cin>>N; long k=2; while(N%k==0)k++; cout<<(k>=N||gcd(N,k)>1?'P':'K')<<'\n'; } }