import sys input = sys.stdin.readline query = [int(input()) for _ in [0] * int(input())] for n in query: s = sum((n % i == 0) for i in range(1, n + 1)) if(s & 1): print('P') else: print('K')