#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define llint long long #define inf 1e18 #define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++) #define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++) #define chmin(x, y) (x) = min((x), (y)) #define chmax(x, y) (x) = max((x), (y)) using namespace std; typedef pair P; llint T; llint n; string s; bool calc(llint l, llint r) { if(l > r) return false; if(r-l+1 < 3) return false; llint cnt = 0; for(int i = l; i <= r; i++){ if(s[i] == 'o') cnt++; else{ if(cnt >= 2) return true; cnt = 0; } } if(cnt >= 2) return true; for(int i = l; i <= r; i++){ if(s[i] != 'o') continue; if(i >= l+1 && i+2 <= r && s[i-1] == '-' && s[i+1] == '-' && s[i+2] == '-') return true; if(i >= l+2 && i+1 <= r && s[i-2] == '-' && s[i-1] == '-' && s[i+1] == '-') return true; if(i >= l+2 && s[i-2] == 'o') return true; if(i >= l+4 && s[i-4] == 'o') return true; } return false; } int main(void) { ios::sync_with_stdio(0); cin.tie(0); cin >> T; for(int t = 0; t < T; t++){ cin >> n >> s; llint l = 0; bool ans = false; for(int i = 0; i < s.size(); i++){ if(s[i] == 'x'){ ans |= calc(l, i-1); //if(calc(l, i-1)) cout << l << " " << i-1 << endl; l = i+1; } } ans |= calc(l, n-1); if(ans) cout << "O" << endl; else cout << "X" << endl; } return 0; }