#include #include #include #include #include #include #include using namespace std; typedef long long ll; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; int T; cin >> T; for(int d = 0; d < T; d++){ int N; string S; cin >> N >> S; bool ok = false; for(int i = 0; i+2 < N; i++){ if(S[i] == 'o' && S[i+1] == 'o' && S[i+2] == '-') ok = true; if(S[i] == '-' && S[i+1] == 'o' && S[i+2] == 'o') ok = true; if(S[i] == 'o' && S[i+1] == '-' && S[i+2] == 'o') ok = true; if(S[i] == 'o' && S[i+1] == 'o' && S[i+2] == 'o') ok = true; } for(int i = 0; i+3 < N; i++){ if(S[i] == '-' && S[i+1] == 'o' && S[i+2] == '-' && S[i+3] == '-') ok = true; if(S[i] == '-' && S[i+1] == '-' && S[i+2] == 'o' && S[i+3] == '-') ok = true; } int cnto = 0; int cntx = 0; int cnt_ = 0; for(int i = 0; i < N; i++){ if(S[i] == 'x') { cntx++; } if(S[i] == '-') cnt_++; if(S[i] == 'o'){ if((cnto > 0) && (cnt_%2 == 1) && (cntx == 0)) { if(ok == false) return -1; ok = true; } // if(cnt_%2 == 1 ) ok = true; cnt_ = 0; cntx = 0; cnto++; } } if(ok) cout << 'O' << endl; else cout << 'X' << endl; } }