#include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int t; cin >> t; for (int i = 0; i < t; i++) { int n; cin >> n; string s; cin >> s; bool ok = false; for (int i = 0; i < n - 2; i++) { if (s[i] == 'o' && s[i + 1] == 'o' && s[i + 2] == '-') { ok = true; } else if (s[i] == '-' && s[i + 1] == 'o' && s[i + 2] == 'o') { ok = true; } else if (s[i] == 'o' && s[i + 1] == 'o' && s[i + 2] == 'o') { ok = true; } else if (s[i] == 'o' && s[i + 1] == '-' && s[i + 2] == 'o') { ok = true; } } for (int i = 0; i < n - 4; i++) { if (s[i] == '-' && s[i + 1] == '-' && s[i + 2] == 'o' && s[i + 2] == '-' && s[i + 2] == '-') { ok = true; } } if (ok) { puts("O"); } else { puts("X"); } } return 0; }