#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; constexpr int INF = 1001001001; constexpr int mod = 1000000007; // constexpr int mod = 998244353; template inline bool chmax(T& x, T y){ if(x < y){ x = y; return true; } return false; } template inline bool chmin(T& x, T y){ if(x > y){ x = y; return true; } return false; } void solve(){ int N; string S; cin >> N >> S; for(int i = 0; i + 2 < N; ++i){ if(S[i] == 'o' && S[i + 1] == 'o' && S[i + 2] == 'o'){ cout << "O\n"; return; } } for(int i = 0; i < N; ++i){ if(S[i] == '-'){ if(i - 2 >= 0 && S[i - 2] == 'o' && S[i - 1] == 'o'){ cout << "O\n"; return; } if(i + 2 < N && S[i + 1] == 'o' && S[i + 2] == 'o'){ cout << "O\n"; return; } } } for(int i = 0; i + 1 < N; ){ if(S[i] == 'o' && S[i + 1] == '-'){ int cnt = 1, j = i + 2; while(j < N && S[j] == '-'){ ++cnt; ++j; } if(j < N && S[j] == 'o' && cnt % 2 == 1){ cout << "O\n"; return; } i = j; } else ++i; } cout << "X\n"; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int T; cin >> T; while(T--) solve(); return 0; }