for t in [0]*int(input()): N=int(input()) print("KP"[N==pow(N,0.5)**2::2])