#include using namespace std; bool solve(string &S){ int N = S.size(); vector P; for (int i = 0; i < N; i++){ if (S[i] == 'x'){ P.push_back(""); } else { P[P.size() - 1] += S[i]; } } int C = P.size(); for (int i = 0; i < C; i++){ string p = P[i]; int L = P[i].size(); if (L < 3) continue; //A: -oo-でなくooを含む if (p != "-oo-"){ for (int j = 0; j < L - 1; j++){ if (p[j] == 'o' && p[j + 1] == 'o'){ return true; } } } //B: oで始まるか終わり-o-を含む if (p[0] == 'o' || p[L - 1] == 'o'){ for (int j = 1; j < L - 1; j++){ if (p[j - 1] == '-' && p[j] == 'o' && p[j + 1] == '-'){ return true; } } } //C: -o-でなく-o-を含む if (p != "-o-"){ for (int j = 1; j < L - 1; j++){ if (p[j - 1] == '-' && p[j] == 'o' && p[j + 1] == '-'){ return true; } } } //D: oで始まりoで終わり長さが奇数 if (L % 2 == 1){ if (p[0] == 'o' && p[L - 1] == 'o'){ return true; } else { continue; } } } return false; } int main(){ int t; cin >> t; for (int i = 0; i < t; i++){ int N; cin >> N; string S; cin >> S; S = 'x' + S + 'x'; if (solve(S)){ cout << 'O' << endl; } else { cout << 'X' << endl; } } }