t = int(input()) for i in range(t): n,s = map(str,input().split()) print('O') if 'oo-' in s or '-oo' in s or 'ooo' in s else print('X')