h, w = list(map(int, input().split()))

l = [0]*(h+2)

l[0] = '.'*(w+2)

l[-1] = '.'*(w+2)



for _ in range(1, h+1):

  l[_] = '.' + str(eval(input())) + '.'



for i in range(1, h+1):

  for j in range(1, w+1):

    if l[i][j] == '.':

      continue

    else:

      if all (l[i+i_][j+j_] == '.' for i_, j_ in ([1, 0], [-1, 0], [0, 1], [0, -1])):

        print('No')

        exit()

      else:

        continue

else:

  print('Yes')
h, w = list(map(int, input().split()))

M = [str(eval(input())) for _ in range(h)]

M = ['.'*w] + M + ['.'*w]

M = ['.'+c+'.' for c in M]



#print(M)



flag = True

for i in range(1, h+1):

    for j in range(1, w+1):

        if M[i][j] == '#':

            for p, q in (-1, 0), (1, 0), (0, 1), (0, -1):

                ni = i+p

                nj = j+q

                if M[ni][nj] == '#':

                    break

            else:

                flag = False



if flag:

    print('Yes')

else:

    print('No')

h, w = list(map(int, input().split()))
l = [0] * (h + 2)
l[0] = "." * (w + 2)
l[-1] = "." * (w + 2)
for _ in range(1, h + 1):
    l[_] = "." + str(eval(input())) + "."
for i in range(1, h + 1):
    for j in range(1, w + 1):
        if l[i][j] == ".":
            continue
        else:
            if all(
                l[i + i_][j + j_] == "."
                for i_, j_ in ([1, 0], [-1, 0], [0, 1], [0, -1])
            ):
                print("No")
                exit()
            else:
                continue
else:
    print("Yes")

h, w = list(map(int, input().split()))
M = [str(eval(input())) for _ in range(h)]
M = ["." * w] + M + ["." * w]
M = ["." + c + "." for c in M]
# print(M)
flag = True
for i in range(1, h + 1):
    for j in range(1, w + 1):
        if M[i][j] == "#":
            for p, q in (-1, 0), (1, 0), (0, 1), (0, -1):
                ni = i + p
                nj = j + q
                if M[ni][nj] == "#":
                    break
            else:
                flag = False
if flag:
    print("Yes")
else:
    print("No")

-l = [0] * (h + 2) -l[0] = "." * (w + 2) -l[-1] = "." * (w + 2) -for _ in range(1, h + 1): -    l[_] = "." + str(eval(input())) + "." +M = [str(eval(input())) for _ in range(h)] +M = ["." * w] + M + ["." * w] +M = ["." + c + "." for c in M] +# print(M) +flag = True -        if l[i][j] == ".": -            continue -        else: -            if all( -                l[i + i_][j + j_] == "." -                for i_, j_ in ([1, 0], [-1, 0], [0, 1], [0, -1]) -            ): -                print("No") -                exit() +        if M[i][j] == "#": +            for p, q in (-1, 0), (1, 0), (0, 1), (0, -1): +                ni = i + p +                nj = j + q +                if M[ni][nj] == "#": +                    break -                continue +                flag = False +if flag: +    print("Yes") -    print("Yes") +    print("No")