t = int(input()) for _ in range(t): _, S = input().split() if any(i in S for i in ["oo-","-oo","ooo","o-o","--o-","-o--"]): print("O") else: print("X")