#include using namespace std; typedef long long int ll; typedef pair P; typedef vector VI; typedef vector VVI; const ll MOD = 998244353; const ll INF = 2147483647; const ll LINF = 9223372036854775807; #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() string p[2]={"-o--","--o-"}; string q[2]={"oo-","-oo"}; int main(){ int t; cin >> t; while(t--){ int n; cin >> n; string s; cin >> s; bool win=0; REP(i,n-3){ REP(j,2){ bool f=1; REP(k,4)if(p[j][k]!=s[i+k])f=0; if(f){ win=1; break; } } } REP(i,n-2){ REP(j,2){ bool f=1; REP(k,3)if(q[j][k]!=s[i+k])f=0; if(f){ win=1; break; } } } bool f=0; int len=0; REP(i,n){ if(s[i]=='o'){ if(f&&len%2==1){ win=1; len=0; } f=1; } else if(s[i]=='-'&&f) len++; else{ len=0; f=0; } } REP(i,n-2) if(s[i]=='o'&&s[i+1]=='o'&&s[i+2]=='o') win=1; if(win) cout << 'O' << endl; else cout << 'X' << endl; } return 0; }