Test=int(input()) for _ in range(Test): n=int(input()) cnt=0 for i in range(1,n): if n%i==0: cnt+=1 print("P" if cnt%2==0 else "K")