from math import gcd T = int(input()) for _ in range(T) : N = int(input()) fl = 2 while N % fl == 0 : fl += 1 print("K" if gcd(K, fl) == 1 else "P")