# coding:UTF-8 import sys MOD = 10 ** 9 + 7 INF = float('inf') T = int(input()) # 数字 res = [] for _ in range(T): N, S = input().split() # スペース区切り連続文字列 N = int(N) # "ooo" # "-oo" # "oo-" f = 0 for i in range(N-2): s = S[i:i+3] if s == "ooo" or s == "-oo" or s == "oo-": f = 1 # "-o--" # "--o-" for i in range(N-3): s = S[i:i+4] if s == "-o--" or s == "--o-": f = 1 # "o---o" m = 0 h = 0 for i in range(N-4): if S[i] == "-": if m == 1: h += 1 elif S[i] == "o": if m == 1: if h % 2 == 1: f = 1 else: h = 0 m = 1 elif S[i] == "x": m = 0 h = 0 if f: res.append("O") else: res.append("X") for r in res: print(r)