def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) mod=10**9+7 def main(): T=I() for _ in range(T): a,S=input().split() S=["x"]+list(S)+["x"] N=len(S) now="x" length=1 f=0 for i in range(1,N-1): if S[i]==now: length+=1 else: now=S[i] length=1 if now=="o" and length==3: f=1 break elif now=="o" and length==2 and (S[i-1]=="-" or S[i+1]=="-"): f=1 break elif now=="-" and length%2==1 and (S[i-1]=="o" and S[i+1]=="o"): f=1 break if f==1: print("O") else: print("X") main()