#include using namespace std; typedef long long ll; typedef pair l_l; typedef pair i_i; template inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } template inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } return false; } const long double EPS = 1e-10; const long long INF = 1e18; const long double PI = acos(-1.0L); //const ll mod = 1000000007; bool check(string S) { //cerr << S << endl; ll num = 0; for(int i = 0; i < S.size(); i++) { if(S[i] == 'o') num++; } if(num >= 3) return true; if(num <= 1) return false; if((int)S.size() % 2 == 0 and S[0] == 'o' and S.back() == 'o') return false; return true; } void solve() { ll N; string S; cin >> N >> S; S = "x" + S + "x"; ll Last = 0; for(int i = 1; i < S.size(); i++) { if(S[i] == 'x') { if(i - Last - 1 > 0 and check(S.substr(Last+1, i-Last-1))) { cout << "O" << endl; return; } Last = i; } } cout << "X" << endl; } int main() { //cout.precision(10); cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; while(N--) solve(); return 0; }