#include using namespace std; string a = "-o--"; string b = "--o-"; string c = "ooo"; string d = "oo-"; string e = "-oo"; void solve() { int n; string s; cin >> n >> s; auto judge = [&](int i, string &t) { if (i + t.size() >= n) return false; for (int j = 0; j < t.size(); j++) { if (s[i+j] != t[j]) return false; } return true; }; bool ok = false; for (int i = 0; i < n; i++) { ok |= judge(i, a); ok |= judge(i, b); ok |= judge(i, c); ok |= judge(i, d); ok |= judge(i, e); } int c = 0; for (int i = 0; i < n; i++) { if (s[i] == '-') c++; else { if ((c & 1) && c != i) { if (s[i-c-1] == 'o' && s[i] == 'o') { ok = true; } } c = 0; } } if (ok) cout << "O\n"; else cout << "X\n"; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int t; cin >> t; while (t--) solve(); return 0; }