#define _USE_MATH_DEFINES #include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define MT make_tuple #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)<; using vi = vector; using vll = vector; void solve() { int T; cin >> T; while (T--) { int N; string S; cin >> N >> S; char ans = 'X'; auto f = [&](int i) { if (i + 3 > N)return false; int x = 0, o = 0; FOR(j, i, i + 3) { if (S[j] == 'x')x++; else if (S[j] == 'o')o++; } return x == 0 && o >= 2; }; rep(i, N) { if (f(i)) { ans = 'O'; break; } } // ダブルリーチを作れる rep(i, N) if (S[i] == '-') { S[i] = 'O'; int cnt = 0; for (int j = max(0, i - 2); j <= i; ++j) { if (f(j))cnt++; } S[i] = '-'; if (cnt >= 2) { ans = 'O'; break; } } cout << ans << endl; } } int main() { ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15); solve(); return 0; }