#include using lint=long long; using real=long double; int main(){ std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false); std::cout.setf(std::ios_base::fixed);std::cout.precision(15); std::vectorok={"ooo","oo-","-oo"}; auto o_wins=[&](lint n,std::string&s){ for(lint i=0;i<=n-3;i++){ if(std::find(ok.begin(),ok.end(),s.substr(i,3))!=ok.end()){ return true; } } for(lint l=0,r;l>q; while(q--){ lint n;std::string s;std::cin>>n>>s; n+=2; s="x"+s+"x"; std::cout<<(o_wins(n,s)?"O":"X")<<'\n'; } }