R=range P=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53] for t in R(int(input())): N,i=int(input()),0 while N%P[i]<1:i+=1 b=N<3 for j in R(2,P[i]): if N%j:b=1 print("KP"[b])