import sys from math import gcd input = sys.stdin.readline def solve(n): for i in range(2, n): if(n % i == 0): continue if(gcd(i, n) == 1): return 'K' break return 'P' t = int(input()) for _ in [0] * t: n = int(input()) print(solve(n))