def has_three_consecutive_o(s): n = len(s) for i in range(n - 2): if s[i] == 'o' and s[i+1] == 'o' and s[i+2] == 'o': return True return False def can_o_win_next_move(s): n = len(s) for i in range(n): if s[i] != '-': continue # Check left two if i - 2 >= 0 and s[i-1] == 'o' and s[i-2] == 'o': return True # Check left and right if i - 1 >= 0 and i + 1 < n and s[i-1] == 'o' and s[i+1] == 'o': return True # Check right two if i + 2 < n 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() S = list(S) if has_three_consecutive_o(S): print("O") continue if can_o_win_next_move(S): print("O") else: print("X")