//Let's join Kaede Takagaki Fan Club !! #include #include #include using namespace std; typedef long long ll; typedef pair P; typedef pair P1; typedef pair P2; #define pu push #define pb push_back #define mp make_pair #define eps 1e-7 #define INF 1000000000 #define fi first #define sc second #define rep(i,x) for(int i=0;i void dmp(T a){ rep(i,a.size()) cout << a[i] << " "; cout << endl; } template bool chmax(T&a, T b){ if(a < b){ a = b; return 1; } return 0; } template bool chmin(T&a, T b){ if(a > b){ a = b; return 1; } return 0; } template void g(T &a){ cin >> a; } template void o(const T &a,bool space=false){ cout << a << (space?' ':'\n'); } //ios::sync_with_stdio(false); const ll mod = 1000000007;//998244353 template void add(T&a,T b){ a+=b; if(a >= mod) a-=mod; } int t; void solve(){ int n; string s; g(n); g(s); bool ok = 0; rep(i,n-2){ if(s[i] == s[i+1] && s[i] == s[i+2] && s[i] == 'o') ok = 1; if(s[i] == '-' && s[i+1] == 'o' && s[i+2] == 'o') ok = 1; if(s[i+2] == '-' && s[i+1] == 'o' && s[i] == 'o') ok = 1; if(s[i] == 'o' && s[i+1] == '-' && s[i+2] == 'o') ok = 1; } rep(i,n){ if(s[i] != 'o') continue; int L = 0, R = 0, a; a = i-1; while(a >= 0 && s[a] == 'o'){ L++; a--; } a = i+1; while(a < n && s[a] == 'o'){ R++; a++; } if(min(L,R) >= 1 && max(L,R) >= 2) ok = 1; } o(ok?"O":"X"); } int main(){ ios::sync_with_stdio(false); g(t); while(t--) solve(); }