#include using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int t; cin >> t; for (int i = 0; i < t; i++) { int n; string s; cin >> n >> s; bool flag = false; for (int j = 0; j < n; j++) { string a, b, c; if (n - j >= 3) { a = s.substr(j, 3); if (a == "ooo" || a == "-oo" || a == "o-o" || a == "oo-") { cout << "O\n"; flag = true; break; } } if (n - j >= 4) { b = s.substr(j, 4); if (b == "--o-" || b == "-o--") { cout << "O\n"; flag = true; break; } } } if (!flag) { int count = 0; for (int j = 1; j < n; j++) { if (s.at(j - 1) == 'o' && s.at(j) == '-') count = 1; else if (s.at(j) == '-' && count > 0) count++; else if (s.at(j) == 'x') count = 0; else if (s.at(j) == 'o') { if (count % 2 == 1) { cout << "O\n"; flag = true; break; } } } } if (!flag) cout << "X\n"; } }