import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); PrintWriter pw = new PrintWriter(System.out); label: for (int i = 0; i < t; i++) { String[] sa = br.readLine().split(" "); String s = sa[1]; if (s.indexOf("ooo") != -1 || s.indexOf("oo-") != -1 || s.indexOf("-oo") != -1 || s.indexOf("--o-") != -1 || s.indexOf("-o--") != -1 || s.indexOf("o-o") != -1 ) { pw.println("O"); } else { int cnt = 0; for (int j = 0; j < s.length(); j++) { if (s.charAt(j) == 'o') { if (cnt > 0 && cnt % 2 == 0) { pw.println("O"); continue label; } cnt = 1; } else if (s.charAt(j) == 'x') { cnt = 0; } else { if (cnt > 0) { cnt++; } } } pw.println("X"); } } br.close(); pw.flush(); } }