import sys input = sys.stdin.readline 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 = A[i] 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 A[i+1][j] != '.' and pre and pre2: print("Yes") return if j > l and A[i+1][j-1] != '.': pre = True if A[i+1][j] == '#': pre2 = False else: pre2 = True l = r print("No") for i in range(int(input())): solve()