#include #include #include #include #include #include #include #include #include #include #include //lcm #include //double精度 setprecision #define rep(i,n) for(int i = 0; i < (n); ++i) #define rrep(i,n) for(int i = n-1; i >= 0; --i) #define rep1(i,n) for(int i = 1; i <= (n); ++i) #define all(vec) (vec).begin(),(vec).end() #define debug(vec) for(auto v : vec) cout << v << " "; cout << endl; #define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << v << " "; cout << endl; } using namespace std; typedef long long ll; const ll INF = 1000000000; //10^10 //const ll MOD = 998244353; const ll MOD = 1000000007; templateinline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } else return false; } templateinline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } else return false; } int main() { int t; cin >> t; rep(test, t) { int n; cin >> n; string s; cin >> s; bool ok = false, cntOk = false; int cnt = 0; rep(i, n) { if (s[i] == 'x') { cntOk = false; cnt = 0;} if (s[i] == 'o' && cntOk) { cntOk = true; if (cnt & 1) {ok = true; break; }cnt = 0; } if (cntOk && s[i] == '-') cnt++; } auto f = [&](string ss) { return s.find(ss) != string::npos; }; if (f("ooo") || f("-oo") || f("oo-") || f("-o--") || f("--o-") || ok) cout << 'O' << endl; else cout << 'X' << endl; } }