use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let t: usize = itr.next().unwrap().parse().unwrap(); let mut out = Vec::new(); for _ in 0..t { let n: usize = itr.next().unwrap().parse().unwrap(); let s: Vec = itr.next().unwrap().chars().collect(); let mut oo = 0; let mut idx = 0; while idx < n { if s[idx] == 'o' { let mut tmp = 0; idx += 1; while idx < n && s[idx] == '-' { tmp += 1; idx += 1; } if idx < n && s[idx] == 'o' { oo = std::cmp::max(oo, tmp); } } else { idx += 1; } } if oo % 2 != 0 { writeln!(out, "O").ok(); continue; } let mut o = false; if n > 2 { for i in 0..n - 2 { if s[i] == 'o' && s[i + 1] == 'o' && s[i + 2] != 'x' { o = true; } if s[i] != 'x' && s[i + 1] == 'o' && s[i + 2] == 'o' { o = true; } if i < n - 3 { if s[i] == '-' && s[i + 1] == 'o' && s[i + 2] == '-' && s[i + 3] == '-' { o = true; } if s[i] == '-' && s[i + 1] == '-' && s[i + 2] == 'o' && s[i + 3] == '-' { o = true; } } } } if o { writeln!(out, "O").ok(); } else { writeln!(out, "X").ok(); } } stdout().write_all(&out).unwrap(); }