t=int(input()) for _ in range(t): n=int(input()) a=0 for i in range(1,int(n**0.5)+1): if n%i==0: a+=1 if n//i>i: a+=1 print("KP"[a%2])