#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[3]={"oo-","o-o","-oo"}; int main(){ int t; cin >> t; while(t--){ int n; cin >> n; string s; cin >> s; int m=0; REP(i,n-2){ REP(j,3){ bool f=1; REP(k,3)if(p[j][k]!=s[i+k])f=0; if(f){ m++; i+=2; break; } } } bool win=0; REP(i,n-2) if(s[i]=='o'&&s[i+1]=='o'&&s[i+2]=='o') win=1; if(win||m>=1) cout << 'O' << endl; else cout << 'X' << endl; } return 0; }