#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; while (t--) { int n; string s; cin >> n >> 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-o") win = true; } cout << (win ? 'O' : 'X') << endl; } return 0; }