def solve(): H,W = map(int, input().split()) A = [[c for c in input()] for i in range(H)] for i in range(H-1): l = 0 r = 0 while l < W: B = [c.replace('?', '#') for c in A[i]] C = [c for c in A[i+1]] while r < W and B[l] == B[r]: r += 1 if B[l] == '#': pre = False #2つ以上前に壁を設置できるか pre2 = False #直前を.にできるか for j in range(l, r): if C[j] != '.' and pre and pre2: print("Yes") return if j > l and C[j-1] != '.': pre = True if C[j] == '#': pre2 = False else: pre2 = True l = r print("No") for i in range(int(input())): solve()