#include #include #include void solve() { int n; std::string s; std::cin >> n >> s; bool ans = false; for (int i = 0; i < n; ++i) { if (s.substr(i, 4) == "--o-" || s.substr(i, 4) == "-o--") ans = true; } for (int i = 0; i < 2; ++i) { int c1 = -1, c2 = -1; for (auto c : s) { if (c == 'x') { c1 = c2 = -1; } else { int c0 = (c == 'o'); if ((c1 == 1 && c2 == 1) || (c0 == 1 && c2 == 1) || (c0 == 1 && c1 == 1 && c2 != -1)) { ans = true; } if (c2 == 1) { c0 = 1; c1 = -1; } c2 = c1; c1 = c0; } } std::reverse(s.begin(), s.end()); } std::cout << (ans ? 'O' : 'X') << std::endl; } int main() { std::cin.tie(nullptr); std::cout.tie(nullptr); std::ios::sync_with_stdio(false); int q; std::cin >> q; while (q--) solve(); return 0; }