for _ in range(int(input())): N = int(input()) flag = True for i in range(1, N+1): if N % i == 0: flag ^= True print('K' if flag else 'P')