#include #include void solve() { int n; std::string s; std::cin >> n >> s; auto judge = [&](int l, int r) -> bool { for (int i = std::max(0, l); i < std::min(n, r); ++i) { if (s.substr(i, 3) == "ooo" || s.substr(i, 4) == "-oo-" || s.substr(i, 5) == "o-o-o") { return true; } } return false; }; bool ans = judge(0, n); for (int i = 0; i < n; ++i) { if (s[i] != '-') continue; s[i] = 'o'; if (judge(i - 5, i + 5)) ans = true; s[i] = '-'; } 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; }