/*** author: yuji9511 ***/ #include using namespace std; using ll = long long; using lpair = pair; const ll MOD = 1e9+7; const ll INF = 1e18; #define rep(i,m,n) for(ll i=(m);i<(n);i++) #define rrep(i,m,n) for(ll i=(m);i>=(n);i--) #define printa(x,n) for(ll i=0;i void print(H&& h, T&&... t){cout<(t)...);} int main(){ cin.tie(0); ios::sync_with_stdio(false); ll T; cin >> T; while(T--){ ll N; string S; cin >> N >> S; bool win = false; ll cnt = 0; rep(i,0,N){ if(S[i] == 'o'){ cnt++; }else{ cnt = 0; } if(cnt == 3) win = true; if(cnt == 2){ if((i - 2 >= 0 && S[i-2] == '-') || (i+1 < N && S[i+1] == '-')) win = true; } if(cnt == 1){ if(i - 2 >= 0 && i+1 < N && S[i-2] == '-' && S[i-1] == '-' && S[i+1] == '-') win = true; if(i - 1 >= 0 && i+2 < N && S[i-1] == '-' && S[i+1] == '-' && S[i+2] == '-') win = true; } } if(win){ print("O"); }else{ print("X"); } } }