int@T,P[50];Prime(54,P);rep(t,T){ll@N,i=-1,b=N<3;while(N%P[++i]<1);rep(j,2,P[i])if(N%j)b=1;wt(b?"P":"K");}