input = $<.read.split.map(&:to_i)
T = input.shift
ans = (0 ... T).map { input.shift == 1 ? "P" : "K" }
puts ans.join("\n")