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