We have a canvas divided into a grid with H rows and W columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j).

Initially, all the squares are white. square1001 wants to draw a picture with black paint. His specific objective is to make Square (i, j) black when s_{i, j}= #, and to make Square (i, j) white when s_{i, j}= ..

However, since he is not a good painter, he can only choose two squares that are horizontally or vertically adjacent and paint those squares black, for some number of times (possibly zero). He may choose squares that are already painted black, in which case the color of those squares remain black.

Determine if square1001 can achieve his objective.  

-----Constraints-----
 - H is an integer between 1 and 50 (inclusive).
 - W is an integer between 1 and 50 (inclusive).
 - For every (i, j) (1 \leq i \leq H, 1 \leq j \leq W), s_{i, j} is # or ..

-----Input-----
Input is given from Standard Input in the following format:
H W
s_{1, 1} s_{1, 2} s_{1, 3} ... s_{1, W}
s_{2, 1} s_{2, 2} s_{2, 3} ... s_{2, W}
  :   :
s_{H, 1} s_{H, 2} s_{H, 3} ... s_{H, W}

-----Output-----
If square1001 can achieve his objective, print Yes; if he cannot, print No.

-----Sample Input-----
3 3
.#.
###
.#.

-----Sample Output-----
Yes

One possible way to achieve the objective is shown in the figure below. Here, the squares being painted are marked by stars.

Difficulty: introductory

Starter code:

Solutions:
h,w=list(map(int,input().split()))
dx=[0,1,0,-1] ; dy=[1,0,-1,0]
A=[list(input()) for i in range(h)]

for i in range(h):
    for  j in range(w):
        if A[i][j]=="#":
            for q,e in zip(dx,dy):
                if 0<=i+q<h and 0<=j+e<w:
                    if A[i+q][e+j]=="#":break
            else:
                print("No");return
print("Yes")


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

ans = 'Yes'

s = []
for i in range(h):
    s += input().split()

# 1文字ずつリストにする
s = list(map(list, s))

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            # 上下左右をチェック
            # 仲間がいる時False、孤立しているときTrue
            if i > 0:
                flg_up = False if s[i-1][j] == '#' else True
            else:
                flg_up = True
            if i < h - 1:
                flg_down = False if s[i+1][j] == '#' else True
            else:
                flg_down = True
            if j > 0:
                flg_left = False if s[i][j-1] == '#' else True
            else:
                flg_left = True
            if j < w - 1:
                flg_right = False if s[i][j+1] == '#' else True
            else:
                flg_right = True
            # 1つでも孤立でないフラグがあれば孤立でないのでFalse、全部孤立の時True
            if flg_up & flg_down & flg_left & flg_right:
                ans = 'No'
                break
    else:
        continue
    break

print(ans)

from itertools import product


H, W = list(map(int, input().split()))
s = [input() for _ in range(H)]
for i, j in product(list(range(H)), list(range(W))):
    if s[i][j] == ".":
        continue
    is_ok = False
    for di, dj in (1, 0), (-1, 0), (0, 1), (0, -1):
        ni, nj = i + di, j + dj
        if not (0 <= ni < H and 0 <= nj < W):
            continue
        if s[ni][nj] == "#":
            is_ok = True
    if not is_ok:
        print("No")
        break
else:
    print("Yes")


h, w = list(map(int, input().split()))
S = [input() for i in range(h)]
for i, T in enumerate(S):
    for j, t in enumerate(T):
        if t == "#":
            flag = 0
            if j > 0:
                if T[j - 1] == "#":
                    flag += 1
            if j < w - 1:
                if T[j + 1] == "#":
                    flag += 1
            if i > 0:
                if S[i - 1][j] == "#":
                    flag += 1
            if i < h - 1:
                if S[i + 1][j] == "#":
                    flag += 1
            if flag == 0:
                print("No")
                return
print("Yes")


import sys

input = sys.stdin.readline

d = '.'
dn = '#'

def isPaintable(h, w, x, y, canvas):
    if x > 0:
        if canvas[y][x-1] == dn:
            return True
    if x < w-1:
        if canvas[y][x+1] == dn:
            return True
    if y > 0:
        if canvas[y-1][x] == dn:
            return True
    if y < h-1:
        if canvas[y+1][x] == dn:
            return True
    return False

def main():
    ans = 'Yes'
    h, w = map(int, input().split())
    canvas = []
    for _ in range(h):
        s = list(input().rstrip('\n'))
        canvas.append(s)
    for y in range(h):
        if ans == 'No':
            break
        for x in range(w):
            if canvas[y][x] == dn and not isPaintable(h, w, x, y, canvas):
                ans = 'No'
                break
    print(ans)

def __starting_point():
    main()
__starting_point()

h, w = map(int, input().split())
ss = [input() for i in range(h)]
sm = ['.'+s+'.' for s in ss]
mm = ['.'*(w+2)]+sm+['.'*(w+2)]

for i in range(1,h+1):
  for j in range(1,w+1):
    if mm[i][j] == '#' and mm[i][j-1] == '.' and mm[i][j+1] == '.' and mm[i-1][j] =='.' and mm[i+1][j] == '.':
      print('No')
      return


print('Yes')

H, W = map(int, input().split())
S = []
for _ in range(H):
    s = list(input())
    S.append(s)
    
cnt = [[0]*W for _ in range(H)]

for h in range(H):
    c = 0
    for w in range(W):
        if S[h][w] == "#":
            c += 1
        else:
            if c == 1:
                cnt[h][w-1] = 1
            c = 0
    if c == 1:
        cnt[h][w] = 1

ans = "Yes"
for w in range(W):
    c = 0
    for h in range(H):
        if S[h][w] == "#":
            c += 1
        else:
            if c == 1:
                if cnt[h-1][w] == 1:
                    ans = "No"
                    break
            c = 0
    if c == 1:
        if cnt[h][w] == 1:
            ans = "No"
            break
            
print(ans)

h,w = list(map(int, input().split()))
s = [input() for _ in range(h)]

for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            flag = False
            for i_new, j_new in [(i+1, j), (i-1, j), (i,j+1), (i,j-1)]:
                if i_new<0 or i_new>=h or j_new<0 or j_new>=w: continue
                if s[i_new][j_new] == "#":
                    flag = True
                    break
            if not flag:
                print("No")
                return
print("Yes")


# -*- coding: utf-8 -*-
"""
Created on Fri Sep 18 10:13:51 2020

@author: liang
"""
H, W = map(int, input().split())
flag = True
field = [input() for i in range(H)]

for i in range(H):
    for j in range(W):
        if field[i][j] == "#":
            tmp = False
            if i-1>= 0 and field[i-1][j] == "#":
                tmp = True
            if i+1 < H and field[i+1][j] == "#":
                tmp = True
            if j-1>= 0 and field[i][j-1] == "#":
                tmp = True
            if j+1 < W and field[i][j+1] == "#":
                tmp = True
            if tmp == False:
                flag = False

if flag :
    print("Yes")
else:
    print("No")

import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    h, w = inl()
    grid = [None] * h
    for i in range(h):
        grid[i] = ins()
    dx = [0, 0, 1, -1]
    dy = [1, -1, 0, 0]
    for i in range(h):
        for j in range(w):
            if grid[i][j] != "#":
                continue
            ok = False
            for k in range(4):
                i2 = i + dy[k]
                j2 = j + dx[k]
                if 0 <= i2 < h and 0 <= j2 < w and grid[i2][j2] == "#":
                    ok = True
                    break
            if not ok:
                return False
    return True


print("Yes" if solve() else "No")


import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return list(map(int,input().split()))
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

H, W = I()

pad_s = ['.'*(W+2)]
for h in range(H):
  pad_s.append('.' + input() + '.')
pad_s.append('.'*(W+2))

for i,ss in enumerate(pad_s):
  for j,s in enumerate(ss):
    if s == '#'\
      and pad_s[i][j+1] == '.'\
      and pad_s[i][j-1] == '.'\
      and pad_s[i+1][j] == '.'\
      and pad_s[i-1][j] == '.':
      print('No')
      return

print('Yes')


h, w = map(int, input().split())
c = tuple(tuple(0 if i == "." else 1 for i in input()) for _ in range(h))

for i in range(h):
    for j in range(w):
        if c[i][j]:
            T = c[i-1][j] if 0 <= i - 1 else 0
            B = c[i+1][j] if i + 1 < h else 0
            L = c[i][j-1] if 0 <= j - 1 else 0
            R = c[i][j+1] if j + 1 < w else 0

            if not (T or B or L or R):
                print("No")
                break
    else:
        continue
    break
else:
    print("Yes")

h, w = list(map(int, input().split()))
s = [input() for _ in range(h)]

dh = [0, 1, 0, -1]
dw = [1, 0, -1, 0]
flag = 0

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            cnt = 0
            for p in range(4):
                if i + dh[p] < 0 or i + dh[p] >= h or j + dw[p] < 0 or j + dw[p] >= w:
                    continue
                else:
                    if s[i + dh[p]][j + dw[p]] == '#':
                        cnt += 1
            if cnt == 0:
                flag = 1
                break
        if flag == 1:
            break
    if flag == 1:
        print('No')
        break
else:
    print('Yes')
        


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

s = []
for i in range(h):
    s.append('.' + input() + '.')

s = ['.'* (w+2)]  + s + ['.'*(w+2)]

ans = 'Yes'

for i in range(1,h):
    for j in range(1,w):
        if s[i][j] == '#':
            u = s[i - 1][j]
            d = s[i + 1][j]
            l = s[i][j - 1]
            r = s[i][j + 1]
            if u == '.' and d == '.' and l == '.' and r == '.':
                ans = 'No'

print(ans)

h,w=list(map(int,input().split()))
masu=[]
masu.append([])
for i in range(w+2):
  masu[0].append('.')
for i in range(h):
  masu.append([])
  masu[i+1].append('.')
  yoko=input()
  for j in range(w):
    masu[i+1].append(yoko[j])
for i in range(w+2):
  masu[0].append('.')
for i in range(1,h-1):
  for j in range(1,w-1):
    if masu[i][j]=='#':
      if masu[i][j+1]=='.' and masu[i][j-1]=='.' and masu[i+1][j]=='.' and masu[i-1][j]=='.':
        print('No')
        return
print('Yes')

H, W = map(int,input().split())
S = [list(input()) for i in range(H)]

for h in range(H):
    for w in range(W):
        if S[h][w] in ['.', 'B']: continue
        
        ary = [[0,1], [0,-1], [1,0], [-1,0]]
        flag = False
        for x, y in ary:
            xd = h+x
            yd = w+y
            if xd < 0 or xd >= H or yd < 0 or yd >=W: continue
            if S[xd][yd] in ['B', '#']:
                S[h][w] = 'B'
                S[xd][yd] = 'B'
                flag = True
        
        if not flag:
            print('No') 
            return

print('Yes')

H,W = map(int,input().split())
S = [["."] * (W+2)]
for i in range(H):
    S.append(list("."+input().rstrip()+"."))
S.append(["."]*(W+2))
#print(S)

def checkaround(i,j):
    dirc = [[0,1],[-1,0],[0,-1],[1,0]]
    for d in dirc:
        if S[i-d[0]][j-d[1]] == "#":
            return True
    return False
def main():
    for i in range(1,H+1):
        for j in range(1,W+1):
            if S[i][j] == "#":
                if not checkaround(i,j):
                    print("No")
                    return
    print("Yes")

main()

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-06-27 11:11:46 +0900
# LastModified: 2020-10-01 00:51:09 +0900
#


import os
import sys
import numpy as np
# import pandas as pd


def dfs(visited, maze, h, w):
    visited[h, w] = -1
    if maze[h, w+1] == 1 and visited[h, w+1] == 1:
        dfs(visited, maze, h, w+1)
    if maze[h, w-1] == 1 and visited[h, w-1] == 1:
        dfs(visited, maze, h, w-1)
    if maze[h+1, w] == 1 and visited[h+1, w] == 1:
        dfs(visited, maze, h+1, w)
    if maze[h-1, w] == 1 and visited[h-1, w] == 1:
        dfs(visited, maze, h-1, w)


def check_maze(maze, h, w):
    if maze[h, w+1] == 1:
        return 1
    elif maze[h, w-1] == 1:
        return 1
    elif maze[h+1, w] == 1:
        return 1
    elif maze[h-1, w] == 1:
        return 1
    else:
        return 0


def main():
    H, W = list(map(int, input().split()))
    maze = []
    for _ in range(H):
        S = input()
        S = [1 if s == '#' else 0 for s in S]
        maze.append(S)
    maze = np.array(maze)
    maze = np.pad(maze, [(1, 1), (1, 1)])
    visited = np.copy(maze)
    for h in range(1, H+1):
        for w in range(1, W+1):
            if maze[h, w] == 1:
                flag = check_maze(maze, h, w)
                if flag == 0:
                    print("No")
                    return
    print("Yes")


def __starting_point():
    main()

__starting_point()

H, W = map(int, input().split())
grid = [input() for _ in range(H)]

flg = True
for i in range(H):
    for j in range(W):
        if grid[i][j] == '.':
            continue

        flg2 = False
        if j > 0 and grid[i][j - 1] == '#': flg2 = True
        if j < W - 1 and grid[i][j + 1] == '#': flg2 = True
        if i > 0 and grid[i - 1][j] == '#': flg2 = True
        if i < H - 1 and grid[i + 1][j] == '#': flg2 = True

        if not flg2:
            flg = False

print(['No', 'Yes'][flg])

H,W = map(int,input().split())
field = []
for h in range(H):
  field.append(list(input()))

dx = [0, 0, 1, -1]
dy = [1, -1, 0, 0]
ans = 'Yes'
for h in range(H):
  for w in range(W):
    if field[h][w] != '#':
      continue
    ok = False
    for i in range(4):
      nw = dx[i] + w
      nh = dy[i] + h
      if nw < 0 or W <= nw or nh < 0 or H <= nh:
        continue
      if field[nh][nw] == '#':
        ok = True
    if not ok:
      ans = 'No'

print(ans)

H,W=list(map(int,input().split()))

sq=[list(input()) for i in range(H)]

for i in range(H):
    for j in range(W):
        if sq[i][j]=="#":
            temp=0
            if j!=0:
                if sq[i][j-1]=="#":
                    temp+=1
            if j!=W-1:
                if sq[i][j+1]=="#":
                    temp+=1
            if i!=0:
                if sq[i-1][j]=="#":
                    temp+=1
            if i!=H-1:
                if sq[i+1][j]=="#":
                    temp+=1
            if temp==0:
                print("No")
                return

print("Yes")


#上下左右に#が全て隣接しているならOK

N, M = map(int, input().split())
#print(N)
c = 0
l = []
for i in range(N):
  l.append(list(input()))
  
#print(l)
N -= 1
M -= 1

for i in range(N):
  for j in range(M):
    if l[i][j] == ".":
      pass
    else:
      if i-1>=0 and i+1<=N and j-1>=0 and j+1<=M and l[i-1][j] == "." and l[i+1][j] == "." and l[i][j-1] == "." and l[i][j+1] == ".":
        c+=1
      if i==0 and j-1>=0 and j+1<=M and l[i+1][j] == "." and l[i][j-1] == "." and l[i][j+1] == ".":
        c+=1
      if i-1>=0 and i+1<=N and j==0 and l[i-1][j] == "." and l[i+1][j] == "." and l[i][j+1] == ".":
        c+=1
      if i==N and j-1>=0 and j+1<=M and l[i-1][j] == "." and l[i][j-1] == "." and l[i][j+1] == ".":
        c+=1
      if i-1>=0 and i+1<=N and j-1>=0 and j==M and l[i-1][j] == "." and l[i+1][j] == "." and l[i][j-1] == ".":
        c+=1
      if i==0 and j==0 and l[i+1][j] == "." and l[i][j+1] == ".":
        c+=1
      if i==0 and j==M and l[i+1][j] == "." and l[i][j-1] == ".":
        c+=1
      if i==N and j==0 and l[i-1][j] == "." and l[i][j+1] == ".":
        c+=1
      if i==N and j==M and l[i-1][j] == "." and l[i][j-1] == ".":
        c+=1

if c == 0:
  print("Yes")
else:
  print("No")

from itertools import product
H,W=map(int,input().split())
S=[input() for i in range(H)]

isOK=True

for y,x in product(range(H),range(W)):
    if S[y][x]=='.':
        continue
    sum=0

    if 0<x:
        if S[y][x-1]=='#':sum+=1
    
    if x<W-1:
        if S[y][x+1]=='#':sum+=1
    
    if 0<y:
        if S[y-1][x]=='#':sum+=1
    
    if y<H-1:
        if S[y+1][x]=='#':sum+=1
    
    if sum==0:
        isOK=False

if isOK:
    print("Yes")
else:
    print("No")

H,W = list(map(int,input().split()))

S = [input() for i in range(H)]

for i in range(H):
  for j in range(W):
    if S[i][j] != "#":
      continue
    for y,x in ((0,1),(0,-1),(1,0),(-1,0)):
      if 0 <= i + y < H and 0 <= j + x < W:
        if S[i + y][j + x] == "#":
          break
    else:
      print("No")
      return
print("Yes")


H,W = list(map(int,input().split()))
Grid = [["."]*(W+2)]
for i in range(H):
    Grid.append(list("." + str(input()) + "."))
    
Grid.append(["."]*(W+2))
for k in range(1,H+1):
  for l in range(1,W+1):
    moji = Grid[k][l]
    if moji == "#":
      flg = 0
      for rec,col in ((1,0),(0,1),(-1,0),(0,-1)):
        if Grid[k+rec][l+col] == "#":
          Grid[k+rec][l+col] = "b"
          flg = 1
        elif Grid[k+rec][l+col] == "b":
          flg = 1
      
      if flg == 1:
        Grid[k][l] = "b"
      else:
        break
  else:
    continue
  print("No")
  break    
else:
  print("Yes")
        
  


h,w = map(int, input().split())
s = list()
t = list()
a = [0 for i in range(w+2)]
s.append(a)
for i in range(h):
    b = str(input())
    c = list(('0'+b+'0').replace('.','0').replace('#','1'))
    d = list(map(int, c))
    s.append(d)
    t.append(b)
s.append(a)
flag = 0

for j in range(1,h+1):
    for k in range(1,w+1):
        if flag == 1:
            break
        if s[j][k] == 1:
            cnt = 0
            cnt = s[j-1][k] + s[j][k-1] + s[j][k+1] + s[j+1][k] 
            if cnt == 0:
                flag = 1
                print('No')

if flag == 0:
    print('Yes')

H, W = list(map(int, input().split()))
masu = [["." for _ in range(W+2)] for _ in range(H+2)]

for i in range(H):
  masu[i+1][1:W+1] = input()
  
result = [[0 for _ in range(W)] for _ in range(H)]
for i in range(1, H+1):
  for j in range(1, W+1):
    if masu[i][j] == '#':
      x = masu[i-1][j]+masu[i][j-1]+masu[i][j+1]+masu[i+1][j]
      if x.count("#")==0:
        print("No")
        return
        
print("Yes")



H, W = map(int, input().split())
L = ['.' + input() + '.' for _ in range(H)]
L = ['.' * (W + 2)] + L + ['.' * (W + 2)]
for i in range(1, H + 1):
  for j in range(1, W + 1):
    if L[i][j] == "#":
      l = [L[i-1][j], L[i+1][j], L[i][j-1], L[i][j+1]]
      if '#' not in l:
        print('No')
        break
  else:
    continue
  break
else:
  print('Yes')

H, W = map(int, input().split())
grid = []
for i in range(H):
  grid.append([s for s in input()])
 
fail_flg = False
for i in range(H):
  if fail_flg:
    break
  for j in range(W):
    r_ij = grid[i][j]
    if r_ij == ".":
      continue
    else:
      c_ij = 0
      if 0<=i<=H-1 and 1<=j<=W-1:
        if grid[i][j-1] == "#":
          c_ij += 1
      if 0<=i<=H-1 and 0<=j<=W-2:
        if grid[i][j+1] == "#":
          c_ij += 1
      if 1<=i<=H-1 and 0<=j<=W-1:
        if grid[i-1][j] == "#":
          c_ij += 1
      if 0<=i<=H-2 and 0<=j<=W-1:
        if grid[i+1][j] == "#":
          c_ij += 1
      if c_ij == 0:
        fail_flg = True
        break
 
if fail_flg:
  print("No")
else:
  print("Yes")

H,W = map(int,input().split())
s = [list(input()) for _ in range(H)]

jougesayuu = [(-1,0),(1,0),(0,-1),(0,1)]

check = True
for i in range(H):
  for j in range(W):
    if s[i][j] == "#":
      flag = False
      for (n,m) in jougesayuu:
        ni, nj = i + n, j + m
        if ni < 0 or H <= ni or nj < 0 or W <= nj:
          continue
        if s[ni][nj] == "#":
          flag = True
      if not flag:
        check = False
        
print("Yes" if check else "No")

h,w = map(int,input().split())
s = [list(input()) for _ in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            c = 0
            for ni, nj in [(i+1, j),(i, j+1),(i-1, j),(i, j-1)]:
                if 0 <= ni < h and 0 <= nj < w and s[ni][nj] == "#":
                    c += 1
            if c == 0:
                print("No")
                return
print("Yes")

H,W=list(map(int,input().split()))
s=[input() for _ in range(H)]
cells=[(i,j) for i in range(H) for j in range(W)]
di=[1,0,-1,0]
dj=[0,1,0,-1]

for i,j in cells:
    if s[i][j]=='.':
        continue
    flag=False
    for k in range(4):
        ni=i+di[k]
        nj=j+dj[k]
        if ni<0 or nj<0 or ni>=H or nj>=W:
            continue
        if s[ni][nj]=='#':
            flag=True
    if not flag:
        print("No")
        break
else:
    print("Yes")


h, w = map(int, input().split())
c = [input() for _ in range(h)]

ans = 'Yes'

for i in range(h):
    for j in range(w):
        if c[i][j] == "#":
            upper = c[i - 1][j] == "#" if 0 <= i - 1 else False
            lower = c[i + 1][j] == "#" if i + 1 < h else False
            left = c[i][j - 1] == "#" if 0 <= j - 1 else False
            right = c[i][j + 1] == "#" if j + 1 < w else False

            if not (upper or lower or left or right):
                ans = 'No'
                break
    else:
        continue
    break

print(ans)

H, W = list(map(int, input().split()))
m = [] 

for i in range(H):
  s=input()
  t = []
  for i in s:
    t.append(1 if i == "#" else 0)
  m.append(t)
  
for i in range(H):
  for j in range(W):
    if m[i][j] == 0:
      continue
    count = 0
    if i !=0 :
      count += m[i-1][j]
    if i != H-1:
      count += m[i+1][j]
    if j != 0:
      count += m[i][j-1]
    if j != W-1:
      count += m[i][j+1]
    if count > 0:
      continue
    else:
      print("No")
      return
print("Yes")

    


H,W = map(int,input().split())
grid = []
ans = "Yes"

for _ in range(H):
  grid_i = input().split()
  grid.append(grid_i[0])

for i in range(H):
  for j in range(W):
    if grid[i][j] == "#":
      X = "NG"
      if (i-1 >= 0 and grid[i-1][j] == ".") or i < 1:
        None
      else:
        X = "OK"
      if (j-1 >= 0 and grid[i][j-1] == ".") or j < 1:
        None
      else:
        X = "OK"
      if (i+1 < H and grid[i+1][j] == ".") or i+1 >= H:
        None
      else:
        X = "OK"
      if (j+1 < W and grid[i][j+1] == ".") or j+1 >= W:
        None
      else:
        X = "OK"
      if X == "NG":
        ans = "No"

print(ans)

h,w = list(map(int,input().split()))
s = [list(input()) for _ in range(h)]

dxy = [(1,0),(0,1),(-1,0),(0,-1)]
ans = True
for i in range(h):
    for j in range(w):
        cnt = 0
        if s[i][j]=="#":
            for p,q in dxy:
                if not(0<=i+p<h and 0<=j+q<w):
                    cnt += 1 
                    continue
                elif s[i+p][j+q] == ".":
                    cnt += 1
                else:
                    continue
        if cnt == 4:
            ans = False
print(("Yes" if ans==True else "No"))



import sys

input = sys.stdin.readline

def main():
    H, W = list(map(int, input().split()))
    field = []
    for _ in range(H):
        tmp = list(input()[:-1])
        field.append(tmp)
    
    # import
    from collections import deque
    
    # digtmp
    digtmp = [(0, 1), (1, 0), (0, -1), (-1, 0)]
    #digtmp = [(0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1), (1, 0), (1, 1)]
    
    # BFS
    # please prefer objects:
    #  H: height.
    #  W: width
    #  field: maze field made of '.', '#'.
    #  check: check field
    for h in range(H):
        for w in range(W):
            a, b = h, w
            flag = False
            if field[a][b] == '.':
                continue
            for dx, dy in digtmp:
                x = a + dx
                y = b + dy
                if not (0 <= x < H and 0 <= y < W):
                    continue
                if field[x][y] == '#':
                    flag = True
                    continue
            if not flag:
                print('No')
                return
    print('Yes')

def __starting_point():
    main()

__starting_point()

import sys
import copy
import math
import itertools
import numpy as np

H,W = [int(c) for c in input().split()]
s = [list(input()) for c in range(H)]
a = [[1 for c in range(W)] for d in range(H)]
b = [[0 for c in range(W)] for d in range(H)]

for i in range(H):
    for j in range(W):
        if s[i][j]=="#":
            if i-1 >= 0:
                if s[i-1][j] == "#":
                    a[i][j]=0
            if j-1 >= 0:
                if s[i][j-1] == "#":
                    a[i][j]=0
            if j+1 < W:
                if s[i][j+1] == "#":
                    a[i][j]=0
            if i+1 < H:
                if s[i+1][j] == "#":
                    a[i][j]=0
        else:
            a[i][j]=0
        if a[i][j] == 1:
            print("No")
            return

print("Yes")

h, w = list(map(int, input().split()))
table = [list(input()) for _ in range(h)]

mx = [0, 1, 0, -1]#yとの兼ね合いで片方は0にして上下左右判定
my = [1, 0, -1, 0]#xとの兼ね合いで片方は0にして上下左右判定
for i in range(h):
    for j in range(w):
        if table[i][j] == "#":
            for k in range(4):
                tx = j + mx[k]#左右判定
                ty = i + my[k]#上下判定
                if 0 <= tx < w and 0 <= ty < h and table[ty][tx] == "#":#添え字に使えるか判定している
                    break
            else:#breakされなかった時実行される、上下左右に#がなかった時になる
                print("No")
                return
print("Yes")



import sys

H, W = list(map(int, input().split()))
S = [list(sys.stdin.readline().strip()) for _ in range(H)]

dx = [1, 0, -1, 0]
dy = [0, -1, 0, 1]

for i, row in enumerate(S):
    for j, s in enumerate(row):
        if s == ".":
            continue
        ok = False
        for k in range(4):
            nx = j + dx[k]
            ny = i + dy[k]
            if not(0 <= nx < W and 0 <= ny < H):
                continue
            if S[ny][nx] == "#":
                ok = True
        if ok is False:
            print("No")
            return

print("Yes")


H,W=map(int,input().split())
List = [list(input()) for i in range(H)]
res = "Yes"
flag = True

def checkAround(ListX,i,j):
  if i == 0 and j ==0:
    if List[i+1][j] == "#" or List[i][j+1] == "#":
      return True
    else: 
      return False
  elif i == 0 and j !=0 and j != W-1:
    if List[i+1][j] == "#" or List[i][j-1] == "#" or List[i][j+1] == "#":
      return True
    else: 
      return False
  elif i == 0 and j == W-1:
    if List[i+1][j] == "#" or List[i][j-1] == "#":
      return True
    else: 
      return False
  elif i != 0 and i != H-1 and j == 0:
    if List[i+1][j] == "#" or List[i-1][j] == "#" or List[i][j+1] == "#":
      return True
    else: 
      return False
  elif i == H-1 and j == W-1:
    if List[i-1][j] == "#" or List[i][j-1] == "#":
      return True
    else: 
      return False
  elif i == H-1 and j !=0 and j != W-1:
    if List[i-1][j] == "#" or List[i][j+1] == "#" or List[i][j-1] == "#":
      return True
    else: 
      return False
  elif i == H-1 and j == 0:
    if List[i-1][j] == "#" or List[i][j-1] == "#":
      return True
    else: 
      return False
  elif i != 0 and i != H-1 and j == W-1:
    if List[i+1][j] == "#" or List[i-1][j] == "#" or List[i][j-1] == "#":
      return True
    else: 
      return False
  else:
    if List[i+1][j] == "#" or List[i-1][j] == "#" or List[i][j-1] == "#" or List[i][j+1] == "#":
      return True
    else: 
      return False

for k in range(H):
  for l in range(W):
    if List[k][l] == ".":
      pass
    else:
      flag = checkAround(List,k,l)
      if not flag:
        res = "No"
        break
  if not flag:
    break
print(res)

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

ans = 'Yes'



s = []
for i in range(h):
    s += input().split()

# 端の処理を楽にするために周りを . で埋める
## 上端
s.insert(0, ''.join(['.'] * (w + 2)))
## 両端
s = list(map(lambda x: '.' + x + '.', s))
## 下端
s.insert(len(s), ''.join(['.'] * (w + 2)))

# 1文字ずつリストにする
s = list(map(list, s))

# 50 * 50
for i in range(1, h + 1):
    for j in range(1, w + 1):
        if s[i][j] == '#':
            # 上下左右をチェック
            # 仲間がいる時False、孤立しているときTrue
            flg_up = False if s[i-1][j] == '#' else True
            flg_down = False if s[i+1][j] == '#' else True
            flg_left = False if s[i][j-1] == '#' else True
            flg_right = False if s[i][j+1] == '#' else True
            
            # 1つでも孤立でないフラグがあれば孤立でないのでFalse、全部孤立の時True
            if flg_up & flg_down & flg_left & flg_right:
                ans = 'No'
                break
    else:
        continue
    break

print(ans)

h,w = map(int,input().split())
s = [list(input()) for i in range(h)]

for i in range(h):
    s[i].insert(0,'.')
    s[i].append('.')

s.insert(0,['.']*(w+2))
s.append(['.']*(w+2))

flag = True
for i in range(1,h+1):
    for j in range(1,w+1):
        if s[i][j] == '#':
            if     s[i-1][j] == '#' \
                or s[i+1][j] == '#' \
                or s[i][j-1] == '#' \
                or s[i][j+1] == '#':
                continue
            else:
                flag = False
                break
    if flag == False:
        print('No')
        break
else:
    print('Yes')

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

ans = 'Yes'

s = []
for i in range(h):
    s += input().split()

# 1文字ずつリストにする
s = list(map(list, s))

# 50 * 50
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            # 上下左右をチェック
            # 仲間がいる時False、孤立しているときTrue
            if i > 0:
                flg_up = False if s[i-1][j] == '#' else True
            else:
                flg_up = True
            
            if i < h - 1:
                flg_down = False if s[i+1][j] == '#' else True
            else:
                flg_down = True
            
            if j > 0:
                flg_left = False if s[i][j-1] == '#' else True
            else:
                flg_left = True
            
            if j < w - 1:
                flg_right = False if s[i][j+1] == '#' else True
            else:
                flg_right = True
            
            # 1つでも孤立でないフラグがあれば孤立でないのでFalse、全部孤立の時True
            if flg_up & flg_down & flg_left & flg_right:
                ans = 'No'
                break
    else:
        continue
    break

print(ans)

h,w=map(int,input().split())
s=[input() for i in range(h)]
for i in range(1,h-1):
  for j in range(1,w-1):
    if s[i][j]=='#':
      if (s[i+1][j]=='#' or s[i-1][j]=='#' or s[i][j+1]=='#' or s[i][j-1]=='#'):
        continue
      else:
        print('No')
        return
print('Yes')

h,w=map(int,input().split()) 
l = [input() for _ in range(h)]
dx = [1,-1,0,0]
dy = [0,0,1,-1]
for i in range(h):
    for j in range(w):
        if l[i][j] =='#':
            cnt = 0
            for di in range(4):
                y = i+dx[di]
                x = j+dy[di]
                if x<0 or y<0 or x>w-1 or y>h-1:
                    continue
                else:
                    if l[y][x] =='#':
                        cnt +=1
            if cnt == 0:
                print('No')
                return

print('Yes')

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

ans = 'Yes'

s = []
for i in range(h):
    s += input().split()

# 端の処理を楽にするために周りを . で埋める
#   ..........
#   .#.#.#.#..
#   ..##.###..
#   .....##.#.
#   ...##...#.
#   ..####..#.
#   ..........

## 上端
s.insert(0, ''.join(['.'] * (w + 2)))
## 両端
s = list(map(lambda x: '.' + x + '.', s))
## 下端
s.insert(len(s), ''.join(['.'] * (w + 2)))

# 1文字ずつリストにする
s = list(map(list, s))

# 50 * 50
for i in range(1, h + 1):
    for j in range(1, w + 1):
        if s[i][j] == '#':
            # 上下左右をチェック
            # 仲間がいる時False、孤立しているときTrue
            #flg_up = False if s[i-1][j] == '#' else True
            #flg_down = False if s[i+1][j] == '#' else True
            #flg_left = False if s[i][j-1] == '#' else True
            #flg_right = False if s[i][j+1] == '#' else True
            flg_up = True if s[i-1][j] == '.' else False
            flg_down = True if s[i+1][j] == '.' else False
            flg_left = True if s[i][j-1] == '.' else False
            flg_right = True if s[i][j+1] == '.' else False
            
            # 1つでも孤立でないフラグがあれば孤立でないのでFalse、全部孤立の時True
            if flg_up & flg_down & flg_left & flg_right:
                ans = 'No'
                break
    else:
        continue
    break

print(ans)

H,W = list(map(int,input().split()))
L = [list(input()) for _ in range(H)]
for i in range(H):
    for j in range(W):
        if L[i][j] == '#':
            if i != 0 and L[i-1][j] == '#':
                continue
            if i != H-1 and L[i+1][j] == '#':
                continue
            if j != 0 and L[i][j-1] == '#':
                continue
            if j != W-1 and L[i][j+1] == '#':
                continue
            print('No')
            return
print('Yes')



h, w = list(map(int, input().split()))
s = [input() for _ in range(h)]

for i in range(h):
    for j in range(w):
        if s[i][j] == '.':
            continue
        ok = False
        for dx, dy in [(1, 0), (0, 1), (0, -1), (-1, 0)]:
            nx = j + dx
            ny = i + dy
            if 0 <= nx < w and 0 <= ny < h and s[ny][nx] == '#':
                ok = True
        if not ok:
            print('No')
            return
print('Yes')


H,W = list(map(int,input().split()))

S = ["." * (W + 2)] * (H + 2)

for i in range(H):
  S[i + 1] = "." + input() + "."

for i in range(1, H + 1):
  for j in range(1, W + 1):
    if S[i][j] == "#":
      for x,y in ((0,1),(0,-1),(1,0),(-1,0)):
        if S[i + x][j + y] == "#":
          break
      else:
        print("No")
        return
print("Yes")


H,W = list(map(int, input().split()))
s = [input() for _ in range(H)]

import sys
for j in range(1,H-1):
    for i in range(1,W-1):
        if s[j][i] =='#':
            if s[j][i-1] == '#':
                pass
            elif s[j-1][i] == '#':
                pass
            elif s[j][i+1] == '#':
                pass
            elif s[j+1][i] == '#':
                pass
            else:
                print('No')
                return
print('Yes')


H,W = input().split()

dummy_list = ['.'] *(int(W)+2)
square_list=[]
square_list.append(dummy_list)
for i in range(int(H)):
  wide_list = ['.']
  wide_list=wide_list + list(input())
  wide_list.append('.')
  square_list.append(wide_list)
square_list.append(dummy_list)
ans = 'Yes'
for i in range(1,int(H)+1):
  for j in range(1,int(W)+1):

    before_list = square_list[i-1]
    center_list = square_list[i]
    after_list = square_list[i+1]
    if center_list[j] == '.':
      continue
    if before_list[j] == '.' and center_list[j-1] == '.' and center_list[j + 1] == '.' and after_list[j] == '.':
      ans = 'No'

print(ans)

import sys

def check(i,j,s_list,h,w):
    uesita_list = [-1,1]
    sayuu_list = [-1,1]

    for uesita in uesita_list:
        new_i = i + uesita
        if new_i < 0 or new_i > h-1:
            continue
        if s_list[new_i][j] == "#":
            return True

    for sayuu in sayuu_list:
        new_j = j + sayuu
        if new_j > w-1 or new_j < 0:
            continue
        if s_list[i][new_j] == "#":
            return True
    
    return False            


input = sys.stdin.readline

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

s_list = [[0 for _ in range(w)] for _ in range(h)]
for i in range(h):
    w_s_list = input()
    w_s_list = w_s_list.replace('\n','')
    w_s_list = list(w_s_list)
    for j in range(w):
        s_list[i][j] = w_s_list[j]


for i in range(h):
    for j in range(w):
        s = s_list[i][j]
        if s == "#":
            ok_flag = check(i,j,s_list,h,w)
            if not ok_flag:
                print("No")
                return

print("Yes")




# coding: utf-8


def main():
    H, W = list(map(int, input().split()))
    ans = 'Yes'
    grid = [['*'] * (W + 2) for _ in range(H + 2)]
    dir = [[1, 0], [-1, 0], [0, 1], [0, -1]]
    for i in range(H):
        S = list(input())
        for j in range(W):
            grid[i + 1][j + 1] = S[j]
    
    for i in range(H):
        for j in range(W):
            if grid[i + 1][j + 1] == '#':
                flg = True
                for x, y in dir:
                    if grid[i + 1 + x][j + 1 + y] == '#':
                        flg = False
                if flg:
                    ans = 'No'

    print(ans)

def __starting_point():
    main()

__starting_point()

h, w = list(map(int, input().split()))
table = [list(input()) for _ in range(h)]

mx = [0, 1, 0, -1]
my = [1, 0, -1, 0]
for i in range(h):
    for j in range(w):
        if table[i][j] == "#":
            for k in range(4):
                tx, ty = j + mx[k], i + my[k]
                if 0 <= tx < w and 0 <= ty < h and table[ty][tx] == "#":
                    break
            else:
                print("No")
                return
print("Yes")



h, w = [int(x) for x in input().split()]
s_list = [input() for _ in range(h)]

iso_flag = [[True] * w for _ in range(h)]
for i in range(h):
    for j in range(w):
        if s_list[i][j] == ".":
            continue

        flag_r = True
        if j < w - 1 and s_list[i][j + 1] == "#":
            flag_r = iso_flag[i][j + 1] = False
        
        flag_d = True
        if i < h - 1 and s_list[i + 1][j] == "#":
            flag_d = iso_flag[i + 1][j] = False
        
        if iso_flag[i][j] and flag_r and flag_d:
            print("No")
            return
print("Yes")

from itertools import product
H,W=map(int,input().split())
S=[input() for i in range(H)]
 
isOK=True
 
for y,x in product(range(H),range(W)):
    if S[y][x]=='.':
        continue
    sum=0
 
    if 0<x:
        if S[y][x-1]=='#':sum+=1
    
    if x<W-1:
        if S[y][x+1]=='#':sum+=1
    
    if 0<y:
        if S[y-1][x]=='#':sum+=1
    
    if y<H-1:
        if S[y+1][x]=='#':sum+=1
    
    if sum==0:
        isOK=False
 
if isOK:
    print("Yes")
else:
    print("No")

h, w = list(map(int, input().split()))
s = ['.' + input() + '.' for _ in range(h)]
s = ['.' * (w + 2)] + s + ['.' * (w + 2)]

for y in range(1, h + 1):
    for x in range(1, w + 1):
        if s[y][x] == '#' and all(s[y + dy][x + dx] == '.' for dy, dx in [(1, 0), (0, 1), (-1, 0), (0, -1)]):
            print('No')
            return
print('Yes')


import sys
H, W = list(map(int, input().split()))
l = []

for i in range(H):
    l.append(list(input()))

for i in range(H):
    for j in range(W):
        
        if l[i][j] == '.':
            pass
        else:
            count = 0
            if i > 0 and l[i-1][j] == '#':
                    count += 1 #上方向
            if i < (H-1) and l[i+1][j] == '#':
                count += 1     #下方向
            if j > 0 and l[i][j-1] == '#':
                count += 1     #左方向
            if j < (W-1) and l[i][j+1] == '#':
                count += 1     #右方向
            if count == 0:
                print('No')
                return
                
print('Yes')


H,W = map(int, input().split())
s = [input() for _ in range(H)]

import sys
for j in range(1,H-1):
    for i in range(1,W-1):
        if s[j][i] =='#':
            if s[j][i-1] == '#':
                pass
            elif s[j-1][i] == '#':
                pass
            elif s[j][i+1] == '#':
                pass
            elif s[j+1][i] == '#':
                pass
            else:
                print('No')
                return
print('Yes')

from itertools import product
from collections import deque
import numpy as np
class Grid:
    def __init__(self, grid, w=0, h=0, function=lambda x: x):
        self.w = w = w if w else len(grid[0])
        self.h = h = h if h else len(grid)
        dtype = type(function(grid[0][0]))
        self.grid = np.empty((h, w), dtype=dtype)
        for i, row in zip(range(h), grid):
            for j, val in zip(range(w), row):
                self.grid[i][j] = function(val)
    
    def is_valid_x(self, x):
        return 0 <= x < self.w
    def is_valid_y(self, y):
        return 0 <= y < self.h
    def is_valid_xy(self, x, y):
        return self.is_valid_x(x) and self.is_valid_y(y) 
    
    def __iter__(self):
        return iter(self.grid)
    def __repr__(self):
        return '\n'.join([' '.join(map(str, row)) for row in self.grid]) + '\n'
    def __getitem__(self, x):
        return self.grid[x]
    def __setitem__(self, x, val):
        self.grid[x] = val


def dfs(grid, root):
    stack = [root]
    x, y = root
    grid[y, x] = '!'
    while stack:
        x, y = stack.pop()
        yield (x, y)
        for dx, dy in zip([1, 0, -1, 0], [0, 1, 0, -1]):
            nx, ny = x+dx, y+dy
            if grid.is_valid_xy(nx, ny) and grid[ny, nx] == '#':
                stack.append((nx, ny))
                grid[ny, nx] = '!'

h, w = map(int, input().split())
grid = Grid([input() for s in range(h)])

for y, x in product(range(h), range(w)):
    if grid[y, x] == '#':
        if len(list(dfs(grid, (x, y)))) == 1:
            print('No')
            break
else:
    print('Yes')

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

ans = 'Yes'

s = []
for i in range(h):
    s += input().split()

# 端の処理を楽にするために周りを . で埋める
#   ..........
#   .#.#.#.#..
#   ..##.###..
#   .....##.#.
#   ...##...#.
#   ..####..#.
#   ..........

## 上端
s.insert(0, ''.join(['.'] * (w + 2)))
## 両端
s = list(map(lambda x: '.' + x + '.', s))
## 下端
s.insert(len(s), ''.join(['.'] * (w + 2)))

# 1文字ずつリストにする
s = list(map(list, s))

# 50 * 50
for i in range(1, h + 1):
    for j in range(1, w + 1):
        if s[i][j] == '#':
            # 上下左右をチェック
            # 仲間がいる時False、孤立しているときTrue
            #flg_up = False if s[i-1][j] == '#' else True
            #flg_down = False if s[i+1][j] == '#' else True
            #flg_left = False if s[i][j-1] == '#' else True
            #flg_right = False if s[i][j+1] == '#' else True
            flg_up = True if s[i-1][j] == '.' else False
            flg_down = True if s[i+1][j] == '.' else False
            flg_left = True if s[i][j-1] == '.' else False
            flg_right = True if s[i][j+1] == '.' else False
            
            # 1つでも孤立でないフラグがあれば孤立でないのでFalse、全部孤立の時True
            #if flg_up & flg_down & flg_left & flg_right:
            if (s[i-1][j] == '.') & (s[i+1][j] == '.') & (s[i][j-1] == '.') & (s[i][j+1] == '.'):
                ans = 'No'
                break
    else:
        continue
    break

print(ans)

H,W  = map(int,input().split())
s = []
ans = 'Yes'
for _ in range(H):
    s.append(input())

for i in range(1,H-1):
    for j in range(1,W-1):
        if s[i][j]=='#' and s[i][j+1]==s[i+1][j]==s[i][j-1]==s[i-1][j]=='.':
                print('No')
                return
print(ans)

h, w = map(int, input().split())
src = [input() for i in range(h)]

ans = []
for row in src:
        ans.append(list(row))

dxy = [(1, 0), (-1, 0), (0, 1), (0, -1)]
for x in range(h):
        for y in range(w):
                if src[x][y] == ".":
                        continue
                if src[x][y] == "#":
                        flag = 0
                        for dx, dy in dxy:
                                if x + dx < 0 or x + dx > h -1 or y + dy < 0 or y + dy > w - 1:
                                        continue
                                if src[x + dx][y + dy] == "#":
                                        flag = 1
                                        break
                        if flag == 0:
                                print("No")
                                return

print("Yes")

h,w = map(int,input().split())
F = [list(input()) for _ in range(h)]

for i in range(h):
  for j in range(w):
    cnt = 0
    if F[i][j] == '#':
      if 0 <= (i-1) < h: 
        if F[i-1][j] == '#': cnt += 1
      if 0 <= (i+1) < h: 
        if F[i+1][j] == '#': cnt += 1
      if 0 <= (j-1) < w:
        if F[i][j-1] == '#': cnt += 1
      if 0 <= (j+1) < w:
        if F[i][j+1] == '#': cnt += 1
      if cnt == 0:
        print('No')
        return
print('Yes')

from sys import stdin, stdout # only need for big input


def solve():
    h, w = list(map(int, input().split())) 
    grid = [] 
    for _ in range(h):
        s = input()
        assert(len(s) == w)
        grid.append(s)

    for i in range(h):
        for j in range(w):
            if grid[i][j] == '.':
                continue

            isolate = True
            for px in [i-1, i + 1]:
                    if px >= 0 and px < h: 
                        if grid[px][j] == '#':
                            isolate = False
            for py in [j-1, j + 1]:
                if py >= 0 and py < w:
                    if grid[i][py] == '#':
                        isolate = False
            if isolate:
                print("No")
                return
    
    print("Yes")


    
    

def main():
    solve()


def __starting_point():
    main()
__starting_point()

h, w = map(int, input().split())
c = [input() for _ in range(h)]

ans = 'Yes'

for i in range(h):
    for j in range(w):
        if c[i][j] == "#":
            upper = c[i - 1][j] == "#" if 0 <= i - 1 else False
            lower = c[i + 1][j] == "#" if i + 1 < h else False
            left = c[i][j - 1] == "#" if 0 <= j - 1 else False
            right = c[i][j + 1] == "#" if j + 1 < w else False

            if not (upper or lower or left or right):
                ans = 'No'
                break


print(ans)

import sys
H,W = map(int,input().split())
lsHW = [['.' for i in range(W+2)]]
for i in range(H):
    Sls = ['.'] + list(input()) + ['.']
    lsHW.append(Sls)
lsHW.append(['.' for i in range(W+2)])
for i in range(1,H+1):
    for j in range(1,W+1):
        if lsHW[i][j] == '.':
            continue
        else:
            if not (lsHW[i-1][j] == '#' or lsHW[i+1][j] == '#' or lsHW[i][j-1] == '#' or lsHW[i][j+1] == '#'):
                print('No')
                return
print('Yes')

H, W = map(int, input().split())
S = ['.' + input() + '.' for _ in range(H)]
S = ['.'*(W+2)] + S + ['.'*(W+2)]
flag = 0
for i in range(1, H+1):
    for j in range(1,W+1):
        if S[i][j] == '#':
            if S[i-1][j] == '.' and S[i+1][j] == '.' and S[i][j-1] == '.' and S[i][j+1] == '.':
                flag = 1
print('Yes' if flag == 0 else 'No')

h,w = map(int,input().split())
s = []
s.append(["."] * (w+2))
for i in range(h):
  s.append([a for a in input()])
  s[i+1].insert(0, ".")
  s[i+1].append(".")
s.append(["."] * (w+2))
check = True
for j in range(1,h+1):
  for k in range(1,w+1):
    if s[j][k] == "#":
      if s[j+1][k] == "." and s[j-1][k] == "." and s[j][k+1] == "." and s[j][k-1] == ".":
        check = False
print("Yes" if check else "No")

# 今の座標の色が#のとき、上下左右いずれかに#があればおｋ
h, w = list(map(int, input().split()))
table = [input() for _ in range(h)]
step = [0, 1, 0, -1, 0]
for i in range(h):
    for j in range(w):
        if table[i][j] == ".":
            continue
        flag = False
        for k in range(4):
            ny, nx = i + step[k], j + step[k + 1]
            if nx < 0 or nx == w or ny < 0 or ny == h:
                continue
            if table[ny][nx] == "#":
                flag = True
        if flag == False:
            print("No")
            return
print("Yes")


h, w = list(map(int, input().split()))
s = ['.' + input() + '.' for _ in range(h)]
s = ['.' * (w + 2)] + s + ['.' * (w + 2)]

for y in range(1, h + 1):
    for x in range(1, w + 1):
        if s[y][x] == '.':
            continue
        ok = False
        for dy, dx in [(1, 0), (0, 1), (-1, 0), (0, -1)]:
            if s[y + dy][x + dx] == '#':
                ok = True
        if not ok:
            print('No')
            return
print('Yes')


import sys


def LI():
    return list(map(int, input().split()))


def LSH(h):
    return [input() for _ in range(h)]


H, W = LI()
masu = LSH(H)
for i in range(H):
    for j in range(W):
        ok = 0
        if masu[i][j] == ".":
            continue
        if j+1 < W:
            if masu[i][j+1] == "#":
                ok = 1
        if j-1 >= 0:
            if masu[i][j-1] == "#":
                ok = 1
        if i+1 < H:
            if masu[i+1][j] == "#":
                ok = 1
        if i-1 >= 0:
            if masu[i-1][j] == "#":
                ok = 1
        if ok == 0:
            print("No")
            return
print("Yes")


H, W = list(map(int, input().split()))

S = [list(input()) for _ in range(H)]

for h in range(H):
    for w in range(W):
        if S[h][w] == ".":
            continue
        
        if h != 0 and S[h-1][w] == "#":
            continue
        elif h != H-1 and S[h+1][w] == "#":
            continue
        elif w != 0 and S[h][w-1] == "#":
            continue
        elif w != W-1 and S[h][w+1] == "#":
            continue
        
        print("No")
        return

print("Yes")



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

ans = 'Yes'

s = []
for i in range(h):
    s += input().split()

# 1文字ずつリストにする
s = list(map(list, s))

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            # 上下左右をチェック
            # 仲間がいる時False、孤立しているときTrue
            if i > 0:
                flg_up = False if s[i-1][j] == '#' else True
            else:
                flg_up = True
            if i < h - 1:
                flg_down = False if s[i+1][j] == '#' else True
            else:
                flg_down = True
            if j > 0:
                flg_left = False if s[i][j-1] == '#' else True
            else:
                flg_left = True
            if j < w - 1:
                flg_right = False if s[i][j+1] == '#' else True
            else:
                flg_right = True
            # 1つでも孤立でないフラグがあれば孤立でないのでFalse、全部孤立の時True
            if flg_up & flg_down & flg_left & flg_right:
                ans = 'No'
                break

print(ans)

col,row = [int(x) for x in input().split()]
map_list = [[0] * (row+2)]
for i in range(col):
    map_list.append(["0"] + list(input()) + ["0"])
map_list.append(map_list[0])
#print(map_list)

def check(x,y):
    lands = [[x,y]]
    #print(lands)
    area = 0
    sealine = 0
    while lands:
        #print(area)
        #print(lands)
        x,y = lands.pop()
        #print(x,y)
        area += 1
        map_list[y][x] = "2"
        if map_list[y+1][x] == "#":
            lands.append([x,y+1])
        elif not map_list[y+1][x] == "2":
            sealine += 1
        if map_list[y][x+1] == "#":
            lands.append([x+1,y])
        elif not map_list[y][x+1] == "2":
            sealine += 1
        if map_list[y-1][x] == "#":
            lands.append([x,y-1])
        elif not map_list[y-1][x] == "2":
            sealine += 1
        if map_list[y][x-1] == "#":
            lands.append([x-1,y])
        elif not map_list[y][x-1] == "2":
            sealine += 1
        lands = list(map(tuple,lands))
        lands = list(set(lands))
        #print(lands)
    return area

res = "Yes"
for i in range(1,col+1):
    for j in range(1,row+1):
        if map_list[i][j] == "#":
            if check(j,i) == 1:
              res = "No"
print(res)

h,w=map(int,input().split())
a=[input()+'.' for i in range(h)]+['.'*w]
for i in range(h):
    for j in range(w):
        if a[i][j]=="#":
            if any([a[i+1][j]==a[i][j+1]==a[i-1][j]==a[i][j-1]=="."]):
                print('No')
                break
    else:
        continue
    break
else:
    print('Yes')

def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def check(i, j, data):
    return any(data[x][y] == "#"
    for x, y in ((i-1, j), (i+1, j), (i, j-1), (i, j+1)))


def main():
    h, w = Input()
    a = ["-" * (w + 2)]
    data = a + ["-" + input() + "-" for _ in range(h)] + a
    ans = True
    for i in range(1, h+1):
        for j in range(1, w+1):
            if data[i][j] == "#":
                if not check(i, j, data):
                    ans = False
    if ans:
        print("Yes")
    else:
        print("No")


main()

H, W = map(int, input().split())
x = [list(map(str, list(input()))) for l in range(H)]

for i in range(len(x)):
    x[i].insert(0, ".")
    x[i].append(".")
x.insert(0, ["."]*(W+2))
x.append(["."]*(W+2))

for i in range(1, H+1):
    for j in range(1, W+1):
        if x[i][j] == "#":
            if x[i][j-1] == x[i][j+1] == x[i-1][j] == x[i+1][j] == ".":
                print("No")
                return
print("Yes")

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

ans = 'Yes'

s = []
for i in range(h):
    s += input().split()

# 端の処理を楽にするために周りを . で埋める
#   ..........
#   .#.#.#.#..
#   ..##.###..
#   .....##.#.
#   ...##...#.
#   ..####..#.
#   ..........

## 上端
s.insert(0, ''.join(['.'] * (w + 2)))
## 両端
s = list(map(lambda x: '.' + x + '.', s))
## 下端
s.insert(len(s), ''.join(['.'] * (w + 2)))

# 1文字ずつリストにする
s = list(map(list, s))

# 50 * 50
for i in range(1, h + 1):
    for j in range(1, w + 1):
        if (s[i][j] == '#') & (s[i-1][j] == '.') & (s[i+1][j] == '.') & (s[i][j-1] == '.') & (s[i][j+1] == '.'):
            ans = 'No'
            break
    else:
        continue
    break

print(ans)

H,W = list(map(int,input().split()))

S = ["." * (W + 2)]
S += ["." + input() + "." for i in range(H)]
S += ["." * (W + 2)]

for i in range(1, H + 1):
  for j in range(1, W + 1):
    if S[i][j] != "#":
      continue
    for y,x in ((0,1),(0,-1),(1,0),(-1,0)):
      if S[i + y][j + x] == "#":
        break
    else:
      print("No")
      return
print("Yes")


h,w = map(int, input().split())
s = []

for i in range(h):
    li = input()
    s.append(li)


# "#" -> black
# "." -> white

def check(s, x, y, w, h):
    dx = [0,0,-1,1]
    dy = [1,-1,0,0]

    for i in range(4):
        ny, nx = y+dy[i], x+dx[i]
        if 0<=nx<w and 0<=ny<h:
            if s[ny][nx]=="#":
                return True
    return False

ok = True
for i in range(h):
    for j in range(w):
        if s[i][j]=="#":
            ok = check(s, j, i, w, h)
            if not ok:
                break
    if not ok:
        break
if ok or (w==1 and h==1):
    print("Yes")
else:
    print("No")

# -*- coding: utf-8 -*-

def check(H, W, s, x, y):
    res = False
    if x - 1 >= 0 and s[y][x-1] == '#':
        res = True
    if x + 1 < W and s[y][x+1] == '#':
        res = True
    if y - 1 >= 0 and s[y-1][x] == '#':
        res = True
    if y + 1 < H and s[y+1][x] == '#':
        res = True

    return res


H,W = map(int, input().split())
s = []
for h in range(H):
    s.append(list(input()))

for y in range(H):
    for x in range(W):
        if s[y][x] == "#" and not check(H, W, s, x, y):
            print("No")
            return

print("Yes")

H,W = map(int,input().split())

S = ["." * (W + 2)]
S += ["." + input() + "." for i in range(H)]
S += ["." * (W + 2)]

def solve():
  for i in range(1, H + 1):
    for j in range(1, W + 1):
      if S[i][j] != "#":
        continue
      for y,x in ((0,1),(0,-1),(1,0),(-1,0)):
        if S[i + y][j + x] == "#":
          break
      else:
        return "No"
  return "Yes"

print(solve())

H,W = list(map(int,input().split()))

S = ["." * (W + 2)]
S += ["." + input() + "." for i in range(H)]
S += ["." * (W + 2)]

ng = False
for i in range(1, H + 1):
  for j in range(1, W + 1):
    if S[i][j] != "#":
      continue
    for y,x in ((0,1),(0,-1),(1,0),(-1,0)):
      if S[i + y][j + x] == "#":
        break
    else:
      ng = True
print(("YNeos"[ng::2]))


h, w = map(int, input().split())
c = tuple(tuple(0 if i == "." else 1 for i in input()) for _ in range(h))
 
for i in range(h):
    for j in range(w):
        if c[i][j]:
            T = c[i-1][j] if 0 <= i - 1 else 0
            B = c[i+1][j] if i + 1 < h else 0
            L = c[i][j-1] if 0 <= j - 1 else 0
            R = c[i][j+1] if j + 1 < w else 0
 
            if not (T or B or L or R):
                print("No")
                break
    else:
        continue
    break
else:
    print("Yes")

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

square=[]
for _ in range(h):
    square.append(input())

def check(i,j):
    flg = False
    for di,dj in [[-1,0],[1,0],[0,-1],[0,1]]:
        if di+i<0 or dj+j<0:
            continue
        if di+i>=h or dj+j>=w:
            continue
        if square[di+i][dj+j]=="#":
            flg=True
    return flg

for i in range(h):
    for j in range(w):
        if square[i][j]=="#":
            if not check(i,j):
                # print(i,j)
                print('No')
                return

print('Yes')



H, W = [int(i) for i in input().split()]
SS = [input() for _ in range(H)]

def get(lst, i, default=None):
  try:
    return lst[i]
  except IndexError:
    return default

for i in range(H):
  for j in range(W):
    s = SS[i][j]
    if s == '#':
      if '#' not in [get(get(SS, i-1, []), j), get(get(SS, i, []), j-1), get(get(SS, i+1, []), j), get(get(SS, i, []), j+1)]:
        print('No')
        import sys
        return

print('Yes')


h, w = map(int, input().split())
c = [input() for _ in range(h)]

for i in range(h):
    for j in range(w):
        if c[i][j] == "#":
            upper = c[i-1][j] == "#" if 0 <= i - 1 else False
            lower = c[i+1][j] == "#" if i + 1 < h else False
            left = c[i][j-1] == "#" if 0 <= j - 1 else False
            right = c[i][j+1] == "#" if j + 1 < w else False
            
            if not (upper or lower or left or right):
                print("No")
                break
    else:
        continue
    break
else:
    print("Yes")

h,w=map(int,input().split())
lis=[list(input()) for i in range(h)]

ans=[[0]*w for i in range(h)]

for i in range(h):
  for j in range(w):
    x,y=0,0
    if lis[i][j]=="#":
      ans[i][j]=1
      for a in range(-1,2):
        if 0<=i+a<h and lis[i+a][j]=="#" and a!=0:
          x+=1
      ans[i][j]+=x
      for b in range(-1,2):
        if 0<=j+b<w and lis[i][j+b]=="#" and b!=0:
          y+=1
      ans[i][j]+=y
      if ans[i][j]==1:
        print("No")
        return
    else:
      ans[i][j]=0
      
print("Yes")

h,w=map(int,input().split())
a=['.'*(w+2)]
s=['.'+input()+'.' for _ in range(h)]
s=a+s+a
f=True
for i in range(1,h+1):
  for j in range(1,w+1):
    if s[i][j]=='#' and s[i][j-1]=='.' and s[i][j+1]=='.' and s[i-1][j]=='.' and s[i+1][j]=='.':
      f=False
if f:
  print('Yes')
else:
  print('No')

H,W = map(int,input().split())
s = [input() for _ in range(H)]
for i in range(1,H-1):
    for j in range(1,W-1):
        if s[i][j] == "#":
            if s[i][j-1] == "." and s[i][j+1] == "." and s[i-1][j] == "." and s[i+1][j] == ".":
                print("No")
                return
print("Yes")

H,W = map(int,input().split())

canvas = []

for i in range(H):
  canvas.append(list(input()))
  
#print(canvas)
for i in range(H):
  for j in range(W):
    cnt = 0
    if canvas[i][j] == "#":
      for h in range(-1,2):
        for w in range(-1,2):
          if canvas[min(max(i+h,0),H-1)][min(max(j+w,0),W-1)]=="#" and (abs(h)+abs(w))%2==1:
            cnt+=1
      if cnt==0:
        print("No")
        return
print("Yes")

h, w = map(int, input().split())
c = [input() for _ in range(h)]

for i in range(h):
    for j in range(w):
        if c[i][j] == "#":
            upper = c[i-1][j] == "#" if 0 <= i - 1 else False
            lower = c[i+1][j] == "#" if i + 1 < h else False
            left = c[i][j-1] == "#" if 0 <= j - 1 else False
            right = c[i][j+1] == "#" if j + 1 < w else False
            
            if not (upper or lower or left or right):
                print("No")
                break
    else:
        continue
    break
else:
    print("Yes")

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

ans = 'Yes'

s = []
for i in range(h):
    s += input().split()

# 端の処理を楽にするために周りを . で埋める
#   ..........
#   .#.#.#.#..
#   ..##.###..
#   .....##.#.
#   ...##...#.
#   ..####..#.
#   ..........

## 上端
s.insert(0, ''.join(['.'] * (w + 2)))
## 両端
s = list(map(lambda x: '.' + x + '.', s))
## 下端
s.insert(len(s), ''.join(['.'] * (w + 2)))

# 1文字ずつリストにする
s = list(map(list, s))

# 50 * 50
for i in range(1, h + 1):
    for j in range(1, w + 1):
        if s[i][j] == '#':
            # 上下左右をチェック
            # 仲間がいる時False、孤立しているときTrue
            flg_up = False if s[i-1][j] == '#' else True
            flg_down = False if s[i+1][j] == '#' else True
            flg_left = False if s[i][j-1] == '#' else True
            flg_right = False if s[i][j+1] == '#' else True
            
            # 1つでも孤立でないフラグがあれば孤立でないのでFalse、全部孤立の時True
            if flg_up & flg_down & flg_left & flg_right:
                ans = 'No'
                break
    else:
        continue
    break

print(ans)

import re
import copy

def accept_input():
    H, W = list(map(int, input().split()))
    S = []
    for _ in range(H):
        S.append(input())
    return H,W,S

def process(s):
    if s == "#":
        return 1
    else:
        return 0
H,W,S = accept_input()
arr1 = [(-1,-1),(-1,0),(-1,1),(1,-1),(1,0),(1,1),(0,1),(0,-1)]
arr = [(-1,0),(1,0),(0,1),(0,-1)]
new_S = copy.deepcopy(S)
g = 0
b = 0
for i in range(H):
    for j in range(W):
        if new_S[i][j] == "#":
            bl = 0
            for idou in arr:
                if i+idou[0] == -1 or i+idou[0] == H:
                    continue
                elif j+idou[1] == -1 or j+idou[1] == W:
                    continue
                else:
                    if new_S[i+idou[0]][j+idou[1]] == "#":
                        bl = 1
            if bl != 1:
                b = 1
                break
    if b == 1:
        break
if b == 1:
    print("No")
else:
    print("Yes")


import numpy as np


def get_num_bomb(arr, i, j):
    """
    docstring
    """
    temp_arr = np.full([arr.shape[0] + 2, arr.shape[1] + 2], False)
    temp_arr[1:1 + arr.shape[0], 1:1 + arr.shape[1]] = arr[:, :]
    # slice = temp_arr[i:i + 3, j:j + 3]
    return temp_arr[i + 1, j] + temp_arr[i, j + 1] + temp_arr[
        i + 2, j + 1] + temp_arr[i + 1, j + 2]


def main():
    h, w = tuple([int(x) for x in input().split(" ")])
    arr = []
    ret_arr = [[0] * w for i in range(h)]
    for i in range(h):
        x = list([(0 if x == "." else 1) for x in input()])
        # x = list(map(lambda x: x, input()))
        arr.append(x)
    arr = np.array(arr)
    # print(arr)
    for i in range(h):
        for j in range(w):
            if arr[i, j] == 1:
                if get_num_bomb(arr, i, j) == 0:
                    return "No"
    return "Yes"


print((main()))


H, W = map(lambda x:int(x)+2, input().split())
grid = "."*W
for _ in range(H-2):
  grid += "."+input()+"."
grid += "."*W

Flag = True
move_list = [1, -1, W, -W]

for i in range(1, H-1):
  for j in range(1, W-1):
    if grid[i*W+j] == "#" and all(grid[i*W+j+move] == "." for move in move_list):
      Flag = False
      break

if Flag:
  print("Yes")
else:
  print("No")