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); 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 { pw.println("X"); } } br.close(); pw.flush(); } }