import algorithm, math, strutils, sequtils, tables, macros let read* = iterator: string {.closure.} = while true: (for s in stdin.readLine.split: yield s) template input*(T: static[typedesc]): untyped = when T is int: read().parseInt elif T is float: read().parseFloat elif T is string: read() macro dump*(arg: varargs[untyped]): untyped = result = newNimNode(nnkStmtList) for x in arg: let name = toStrLit(x) result.add(quote do: stderr.write `name`, " = " , `x`, ", ") result.add(quote do: stderr.write "\n") proc check(S: string): bool = return S.contains("--o-") or S.contains("-o--") or S.contains("-oo") or S.contains("oo-") or S.contains("o-o") or S.contains("ooo") or S.contains("o---o") or S.contains("o--o-") or S.contains("-o--o") let T = input(int) for _ in 1 .. T: let _ = input(int) let S = input(string) if check(S): echo "O" else: echo "X"