#include #include #include #define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i) #define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i) #define all(x) (x).begin(), (x).end() using namespace std; using ll = long long; template inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;} template inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;} void solve() { int N; string S; cin >> N >> S; if (N < 3) { cout << 'X' << endl; return; } rep(i, 0, N - 2) { if (S[i] == 'o' && S[i + 1] == 'o' && S[i + 2] == 'o') { cout << "O" << endl; return; } if (S[i] == 'o' && S[i + 1] == 'o' && S[i + 2] == '-') { cout << "O" << endl; return; } if (S[i] == '-' && S[i + 1] == 'o' && S[i + 2] == 'o') { cout << "O" << endl; return; } } cout << "X" << endl; } int main() { cin.tie(0); ios::sync_with_stdio(false); int T; cin >> T; rep(_, 0, T) { solve(); } return 0; }