#include #define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i) #define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i) #define foreach(i, n) for(auto &i:(n)) #define pii pair #define pll pair #define all(x) (x).begin(), (x).end() #define bit(x) (1ll << (x)) using ll = long long; //const ll MOD = (ll)1e9+7; const ll MOD = 998244353; const int INF = (ll)1e9+7; const ll INFLL = (ll)1e18; using namespace std; template using vvector = vector>; template using vvvector = vector>>; template using priority_queuer = priority_queue, greater>; template bool chmax(t &a, u b){if(a bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;} #ifdef DEBUG #define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<>=1; } return res; } ll modinv(ll x){ return modpow(x, MOD-2); } bool was_output = false; template void output(t a){ if(was_output)cout << " "; cout << a; was_output = true; } void outendl(){ was_output = false; cout << endl; } ll in(){ ll res; scanf("%lld", &res); return res; } template istream& operator>>(istream&is, vector&x){ for(auto &i:x)is >> i; return is; } template istream& operator>>(istream&is, pair&x){ is >> x.first >> x.second; return is; } template void in(t&x){ cin >> x; } template void out(t x){ cout << x; } vector ins(){ string str; in(str); vector res; foreach(i,str){ res.emplace_back(i=='o'?1:i=='-'?-1:0); } return res; } int count_ok_point(vector line){ int n = line.size(); vector isok(n,false); int cnt = 0; int res = 0; rep(i,n){ if(line[i]==1)++cnt; else if(line[i]==-1 and cnt>=2)isok[i]=true; else cnt=0; } cnt = 0; per(i,n){ if(line[i]==1)++cnt; else if(line[i]==-1 and cnt>=2)isok[i]=true; else cnt=0; } rep(i,n)if(isok[i])++res; return res; } bool func(){ int n = in(); vector isok = ins(); { int cnt = 0; rep(i,n){ if(isok[i]==1){ if(++cnt>=3)return true; } else cnt=0; } } if(count_ok_point(isok)>=1)return true; rep(i,n){ if(i==-1){ isok[i] = 1; if(count_ok_point(isok)>=2)return true; isok[i] = -1; } } return false; } int main(){ int n = in(); rep(i,n){ cout << (func()?"O":"X") << endl; } return 0; }