T = int(input()) for _ in range(T): N, S = input().split() N = int(N) # Check existing triplets of 'o's existing = False for i in range(len(S) - 2): if S[i] == 'o' and S[i+1] == 'o' and S[i+2] == 'o': existing = True break if existing: print("O") continue # Check possible triplets after filling K = S.count('-') o_moves = (K + 1) // 2 possible = False for i in range(len(S) - 2): # Check if any 'x' in the triplet if S[i] == 'x' or S[i+1] == 'x' or S[i+2] == 'x': continue # Count '-' in the triplet m = (S[i] == '-') + (S[i+1] == '-') + (S[i+2] == '-') if m <= o_moves: possible = True break print("O" if possible else "X")