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