#include using namespace std; using ll = long long; using PII = pair; #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(x) x.begin(), x.end() template void chmin(T &a, const T &b) { a = min(a, b); } template void chmax(T &a, const T &b) { a = max(a, b); } struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio; #ifdef DEBUG_ #include "../program_contest_library/memo/dump.hpp" #else #define dump(...) #endif const ll INF = 1LL<<60; void solve() { ll n; string s; cin >> n >> s; REP(i, n-2) { string str = s.substr(i, 3); if(str == "ooo" || str == "oo-" || str == "-oo") { cout << "O\n"; return; } } REP(i, n-3) { string str = s.substr(i, 4); if(str == "-o--" || str == "--o-") { cout << "O\n"; return; } } ll con = 0; bool ok = false; REP(i, n) { if(s[i]=='o') { if(ok) { if(con%2) { cout << "O\n"; return; } } ok = true; } else if(s[i]=='-') { if(ok) con++; } else if(s[i]=='x') { ok = false; } } cout << "X\n"; } int main(void) { ll t; cin >> t; while(t--) solve(); return 0; }