print(*['P' if input() == '1' else 'K' for _ in range(int(input()))], sep='\n')