s=["-oo","oo-","-o--","--o-","ooo"] for _ in range(int(input())): a,b=input().split();ans="X" c=0;d=0;f=0 while d