#include using namespace std; vector> RLEa(string &s){ vector> ret; char back = s.at(0); int streak = 1; for(int i=1; i> T; while(T--){ int N; cin >> N; string s; cin >> s; s += '-'; auto S = RLEa(s); int K = 0,P = 0; for(auto[c,len] : S){ if(c == 'P') P++; if(c == 'K') K++; } if(K >= P) cout << "K" << endl; else cout << "P" << endl; } }