using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[] NMi => ReadLine().Split().Select(c => int.Parse(c) - 1).ToArray(); static int[][] NMap(int n) => Enumerable.Repeat(0, n).Select(_ => NMi).ToArray(); public static void Main() { Solve(); } static void Solve() { var isPrime = Enumerable.Repeat(true, 3_000_001).ToArray(); isPrime[0] = false; isPrime[1] = false; for (var i = 2; i < isPrime.Length; ++i) { if (!isPrime[i]) continue; for (var j = i * 2; j < isPrime.Length; j += i) isPrime[j] = false; } var counts = new int[isPrime.Length]; for (var i = 1; i < counts.Length; ++i) counts[i] = counts[i - 1] + (isPrime[i] ? 1 : 0); var t = NN; var ans = new bool[t]; for (var u = 0; u < t; ++u) { var n = NN; if (!isPrime[n]) { var all = n - 2 - counts[n] + counts[n / 2]; ans[u] = all % 2 == 1; } } WriteLine(string.Join("\n", ans.Select(f => f ? "K" : "P"))); } }