# coding: utf-8 T=int(input()) for i in range(T): N,S=input().split() N=int(N) S=list(S) flg=False L=[0 for i in range(N)] R=[0 for i in range(N)] cnt_brank=0 for i in range(N): if S[i]=="-": cnt_brank+=1 elif S[i]=="o": L[i]=cnt_brank if i>=cnt_brank+1: if S[i-cnt_brank-1]=="o" and cnt_brank%2==1: flg=True cnt_brank=0 else: cnt_brank=0 if i>0: if S[i-1]==S[i]=="o": if i>1: if S[i-2]=="-" or S[i-2]=="o": flg=True if i=2 and R[i]>=2: flg=True if L[i]==1 and R[i]%2==0 and R[i]>=2: flg=True if R[i]==1 and L[i]%2==0 and L[i]>=2: flg=True if flg: print("O") else: print("X")