#include #include #include #include #include #include #include #include #include #include #include #include #include #include typedef long long ll; using namespace std; const ll MOD = 1000000007LL; int main() { cin.sync_with_stdio(false); cin.tie(0); cout.tie(0); int T; cin >> T; vector ans(T); for (int t = 0; t < T; t++) { int n; cin >> n; string s; cin >> s; bool win = false; for (int i = 0; i < n - 2; i++) { string str = s.substr(i, 3); if (str == "ooo") win = true; if (str == "o-o") win = true; if (str == "oo-") win = true; if (str == "-oo") win = true; } for (int i = 0; i < n - 4; i++) { string str = s.substr(i, 5); if (str == "o---o") win = true; if (str == "o--o-") win = true; if (str == "-o--o") win = true; } ans[t] = win ? 'O' : 'X'; } for (char c : ans) cout << c << '\n'; return 0; }