t=int(input()) for i in range(t): n=int(input()) co=0 for j in range(1,n+1): if n%j==0: co+=1 if co%2==0: print("K") else: print("P")