def has_triplet(s): for i in range(len(s) - 2): if s[i] == 'o' and s[i+1] == 'o' and s[i+2] == 'o': return True return False T = int(input()) for _ in range(T): N, S = input().split() N = int(N) count_o = S.count('o') count_x = S.count('x') rem = N - (count_o + count_x) if rem == 0: if has_triplet(S): print("O") else: print("X") else: found = False for i in range(N): if S[i] == '-': temp = S[:i] + 'o' + S[i+1:] if has_triplet(temp): found = True break if found: print("O") else: print("X")