ll@T;rep(T){ll@N,d=0,c=0;string@S;S+='-';rep(i,N)if(S[i]>74){if(c<75)c=S[i];if(S[i+1]<75){if(c==S[i])d+=c>75?1:-1;c=0;}}wt("KP"[d>0]);}