T=int(input()) for i in range(T): N,S=input().split() N=int(N) flag=True for i in range(N-2): if S[i]==S[i+1]==S[i+2]=="o": print("O") flag=False break if (S[i]==S[i+1]=="o") and S[i+2]=="-": print("O") flag=False break if (S[i]==S[i+2]=="o") and S[i+1]=="-": print("O") flag=False break if (S[i+2]==S[i+1]=="o") and S[i]=="-": print("O") flag=False break if i!=N-3: if (S[i+1]=="o") and S[i]==S[i+2]==S[i+3]=="-": print("O") flag=False break if (S[i+2]=="o") and S[i]==S[i+1]==S[i+3]=="-": print("O") flag=False break flag2=False for i in range(1,N): if S[i]!="-": flag2=False if S[i]=="-": if S[i-1]=="o": this=1 flag2=True if S[i]=="-" and i!=N-1: if S[i+1]=="o" and flag2: if this%2==1: print("O") flag=False break else: flag2=False this=-1 elif S[i+1]=="-": if flag2: this+=1 if flag: print("X")