#include using namespace std; using ll = long long; int calc_win(int w, int l, int r) { if(w % 2 == 0) return 0; if(l == 1 && r == 1) return 1; else return 0; } int main() { int t; cin >> t; for(int tt = 0; tt < t; tt++) { int n; cin >> n; string s; cin >> s; bool win = false; for(int i = 1; i < n - 1; i++) { if(s[i - 1] == 'o' && s[i] == 'o' && s[i + 1] == 'o') win = true; } int w = 0, l = 0, r = 0; for(int i = 0; i < n; i++) { if(s[i] != '-') continue; w++; if(i == 0 || s[i - 1] != '-') { if(i && s[i - 1] == 'o') l = 1; if(i > 1 && s[i - 1] == 'o' && s[i - 2] == 'o') l = 2; } if(i == n - 1 || s[i + 1] != '-') { if(i < n - 1 && s[i + 1] == 'o') r = 1; if(i < n - 2 && s[i + 1] == 'o' && s[i + 2] == 'o') r = 2; if(l == 2 || r == 2) win = true; if(calc_win(w, l, r)) win = true; w = 0; l = 0; r = 0;; } } if(win) cout << "O" << endl; else cout << "X" << endl; } return 0; }