#include using namespace std; typedef pair P; typedef long long ll; typedef long double ld; const int inf=1e9+7; const ll longinf=1LL<<60; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) #define F first #define S second const int mx=8010; const ll mod=1e9+7; int main(){ int t; cin >> t; while(t--){ int n; string s; cin >> n >> s; cout<<(regex_search(s,regex("(ooo|oo-|-oo|o-o|--o-|-o--|o---o|o-----o|o-----(--)*o)"))?"O":"X")<