#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int tt; cin >> tt; constexpr unsigned char pe[] = {2,3,4,5,7,8,9,11,13,16,17,19,23,25,27,29,31,32,37,41,43,47,49,53}; constexpr bool res[] = {1,1,0,1,1,0,0,1,1,0,1,1,1,0,0,1,1,0,1,1,1,1,0,1}; while (tt--) { unsigned long long n; cin >> n; if (n == 2) { cout << "P\n"; } else { int i = 0; while (n % pe[i] == 0) i++; cout << "PK"[res[i]] << '\n'; } } }