use std::collections::HashSet; fn g() -> u64 { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().unwrap() } fn main() { for _ in 0..g() { let n = g(); let (mut i, mut v) = (1, HashSet::new()); while i * i <= n { if n % i == 0 { v.insert(i); v.insert(n / i); } i += 1 } println!("{}", if v.len() % 2 < 1 { "K" } else { "P" }) } }