win = ["ooo", "-oo", "o-o", "oo-", "-o--", "--o-"] def solve(): n, S = input().split() for w in win: if w in S: print("O") return S = S.split("o") for s in S: if "x" not in s and len(s) % 2 == 1 and len(s) >= 3: print("O") return print("X") for _ in range(int(input())): solve()