import sys input = sys.stdin.readline def solve(S): if "ooo" in S or "-oo" in S or "oo-" in S or "-o--" in S or "--o-" in S: print("O") return pre = -1 for i in range(int(N)): if S[i] == "x": pre = -1 elif S[i] == "o": if pre != -1 and (i - pre) % 2 == 0: print("O") return pre = i print("X") T = int(input()) for _ in range(T): N, S = input().split() solve(S)