#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep(i,m,n) for(int (i)=(int)(m);(i)<(int)(n);(i)++) #define rep2(i,m,n) for(int (i)=(int)(n)-1;(i)>=(int)(m);(i)--) #define REP(i,n) rep(i,0,n) #define REP2(i,n) rep2(i,0,n) #define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i) #define ll long long #define ull unsigned long long #define all(hoge) (hoge).begin(),(hoge).end() #define en '\n' typedef pair P; constexpr long long INF = 1LL << 60; constexpr int INF_INT = 1 << 25; typedef vector Array; typedef vector Matrix; template using vec = vector; template using vvec = vector>; //constexpr long long MOD = (ll) 1e9+7; constexpr long long MOD = 998244353; template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } struct Edge { int to, cap, rev; Edge(int _to, int _cap, int _rev) { to = _to; cap = _cap; rev = _rev; } }; typedef vector Edges; typedef vector Graph; void add_edge(Graph& G, int from, int to, int cap, bool revFlag, int revCap) { G[from].push_back(Edge(to, cap, G[to].size())); if (revFlag)G[to].push_back(Edge(from, revCap, G[from].size() - 1)); } void solve() { ll n; string s; cin >> n >> s; bool flag = false; REP(i, n - 2) { string t = s.substr(i, 3); if (t == "ooo"||t=="-oo"||t=="oo-"||t=="o-o") flag = true; } bool flag2 = false; ll con = 0; REP(i, n) { if (s[i] == 'o') { if (flag2 && con % 2 == 1) flag = true; con = 0; flag2 = true; } else if (s[i] == 'x') { flag2 = false; } else { if (flag2) con++; } } cout << (flag ? "O" : "X") << en; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); //solve(); int t; cin >> t; REP(i, t) solve(); return 0; }