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.
[{"code": "h,w=list(map(int,input().split()))\ndx=[0,1,0,-1] ; dy=[1,0,-1,0]\nA=[list(input()) for i in range(h)]\n\nfor i in range(h):\n    for  j in range(w):\n        if A[i][j]==\"#\":\n            for q,e in zip(dx,dy):\n                if 0<=i+q<h and 0<=j+e<w:\n                    if A[i+q][e+j]==\"#\":break\n            else:\n                print(\"No\");return\nprint(\"Yes\")\n", "passed": true, "time": 1.68, "memory": 14192.0, "status": "done"}, {"code": "h, w = list(map(int, input().split()))\n\nans = 'Yes'\n\ns = []\nfor i in range(h):\n    s += input().split()\n\n# 1\u6587\u5b57\u305a\u3064\u30ea\u30b9\u30c8\u306b\u3059\u308b\ns = list(map(list, s))\n\nfor i in range(h):\n    for j in range(w):\n        if s[i][j] == '#':\n            # \u4e0a\u4e0b\u5de6\u53f3\u3092\u30c1\u30a7\u30c3\u30af\n            # \u4ef2\u9593\u304c\u3044\u308b\u6642False\u3001\u5b64\u7acb\u3057\u3066\u3044\u308b\u3068\u304dTrue\n            if i > 0:\n                flg_up = False if s[i-1][j] == '#' else True\n            else:\n                flg_up = True\n            if i < h - 1:\n                flg_down = False if s[i+1][j] == '#' else True\n            else:\n                flg_down = True\n            if j > 0:\n                flg_left = False if s[i][j-1] == '#' else True\n            else:\n                flg_left = True\n            if j < w - 1:\n                flg_right = False if s[i][j+1] == '#' else True\n            else:\n                flg_right = True\n            # 1\u3064\u3067\u3082\u5b64\u7acb\u3067\u306a\u3044\u30d5\u30e9\u30b0\u304c\u3042\u308c\u3070\u5b64\u7acb\u3067\u306a\u3044\u306e\u3067False\u3001\u5168\u90e8\u5b64\u7acb\u306e\u6642True\n            if flg_up & flg_down & flg_left & flg_right:\n                ans = 'No'\n                break\n    else:\n        continue\n    break\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14284.0, "status": "done"}, {"code": "from itertools import product\n\n\nH, W = list(map(int, input().split()))\ns = [input() for _ in range(H)]\nfor i, j in product(list(range(H)), list(range(W))):\n    if s[i][j] == \".\":\n        continue\n    is_ok = False\n    for di, dj in (1, 0), (-1, 0), (0, 1), (0, -1):\n        ni, nj = i + di, j + dj\n        if not (0 <= ni < H and 0 <= nj < W):\n            continue\n        if s[ni][nj] == \"#\":\n            is_ok = True\n    if not is_ok:\n        print(\"No\")\n        break\nelse:\n    print(\"Yes\")\n", "passed": true, "time": 0.33, "memory": 14272.0, "status": "done"}, {"code": "h, w = list(map(int, input().split()))\nS = [input() for i in range(h)]\nfor i, T in enumerate(S):\n    for j, t in enumerate(T):\n        if t == \"#\":\n            flag = 0\n            if j > 0:\n                if T[j - 1] == \"#\":\n                    flag += 1\n            if j < w - 1:\n                if T[j + 1] == \"#\":\n                    flag += 1\n            if i > 0:\n                if S[i - 1][j] == \"#\":\n                    flag += 1\n            if i < h - 1:\n                if S[i + 1][j] == \"#\":\n                    flag += 1\n            if flag == 0:\n                print(\"No\")\n                return\nprint(\"Yes\")\n", "passed": true, "time": 0.15, "memory": 14124.0, "status": "done"}, {"code": "import sys\n\ninput = sys.stdin.readline\n\nd = '.'\ndn = '#'\n\ndef isPaintable(h, w, x, y, canvas):\n    if x > 0:\n        if canvas[y][x-1] == dn:\n            return True\n    if x < w-1:\n        if canvas[y][x+1] == dn:\n            return True\n    if y > 0:\n        if canvas[y-1][x] == dn:\n            return True\n    if y < h-1:\n        if canvas[y+1][x] == dn:\n            return True\n    return False\n\ndef main():\n    ans = 'Yes'\n    h, w = map(int, input().split())\n    canvas = []\n    for _ in range(h):\n        s = list(input().rstrip('\\n'))\n        canvas.append(s)\n    for y in range(h):\n        if ans == 'No':\n            break\n        for x in range(w):\n            if canvas[y][x] == dn and not isPaintable(h, w, x, y, canvas):\n                ans = 'No'\n                break\n    print(ans)\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.15, "memory": 14264.0, "status": "done"}, {"code": "h, w = map(int, input().split())\nss = [input() for i in range(h)]\nsm = ['.'+s+'.' for s in ss]\nmm = ['.'*(w+2)]+sm+['.'*(w+2)]\n\nfor i in range(1,h+1):\n  for j in range(1,w+1):\n    if mm[i][j] == '#' and mm[i][j-1] == '.' and mm[i][j+1] == '.' and mm[i-1][j] =='.' and mm[i+1][j] == '.':\n      print('No')\n      return\n\n\nprint('Yes')", "passed": true, "time": 0.15, "memory": 14168.0, "status": "done"}, {"code": "H, W = map(int, input().split())\nS = []\nfor _ in range(H):\n    s = list(input())\n    S.append(s)\n    \ncnt = [[0]*W for _ in range(H)]\n\nfor h in range(H):\n    c = 0\n    for w in range(W):\n        if S[h][w] == \"#\":\n            c += 1\n        else:\n            if c == 1:\n                cnt[h][w-1] = 1\n            c = 0\n    if c == 1:\n        cnt[h][w] = 1\n\nans = \"Yes\"\nfor w in range(W):\n    c = 0\n    for h in range(H):\n        if S[h][w] == \"#\":\n            c += 1\n        else:\n            if c == 1:\n                if cnt[h-1][w] == 1:\n                    ans = \"No\"\n                    break\n            c = 0\n    if c == 1:\n        if cnt[h][w] == 1:\n            ans = \"No\"\n            break\n            \nprint(ans)", "passed": true, "time": 0.33, "memory": 14140.0, "status": "done"}, {"code": "h,w = list(map(int, input().split()))\ns = [input() for _ in range(h)]\n\nfor i in range(h):\n    for j in range(w):\n        if s[i][j] == \"#\":\n            flag = False\n            for i_new, j_new in [(i+1, j), (i-1, j), (i,j+1), (i,j-1)]:\n                if i_new<0 or i_new>=h or j_new<0 or j_new>=w: continue\n                if s[i_new][j_new] == \"#\":\n                    flag = True\n                    break\n            if not flag:\n                print(\"No\")\n                return\nprint(\"Yes\")\n", "passed": true, "time": 0.23, "memory": 14368.0, "status": "done"}, {"code": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Fri Sep 18 10:13:51 2020\n\n@author: liang\n\"\"\"\nH, W = map(int, input().split())\nflag = True\nfield = [input() for i in range(H)]\n\nfor i in range(H):\n    for j in range(W):\n        if field[i][j] == \"#\":\n            tmp = False\n            if i-1>= 0 and field[i-1][j] == \"#\":\n                tmp = True\n            if i+1 < H and field[i+1][j] == \"#\":\n                tmp = True\n            if j-1>= 0 and field[i][j-1] == \"#\":\n                tmp = True\n            if j+1 < W and field[i][j+1] == \"#\":\n                tmp = True\n            if tmp == False:\n                flag = False\n\nif flag :\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.14, "memory": 14180.0, "status": "done"}, {"code": "import sys\n\nsys.setrecursionlimit(10 ** 8)\nini = lambda: int(sys.stdin.readline())\ninl = lambda: [int(x) for x in sys.stdin.readline().split()]\nins = lambda: sys.stdin.readline().rstrip()\ndebug = lambda *a, **kw: print(\"\\033[33m\", *a, \"\\033[0m\", **dict(file=sys.stderr, **kw))\n\n\ndef solve():\n    h, w = inl()\n    grid = [None] * h\n    for i in range(h):\n        grid[i] = ins()\n    dx = [0, 0, 1, -1]\n    dy = [1, -1, 0, 0]\n    for i in range(h):\n        for j in range(w):\n            if grid[i][j] != \"#\":\n                continue\n            ok = False\n            for k in range(4):\n                i2 = i + dy[k]\n                j2 = j + dx[k]\n                if 0 <= i2 < h and 0 <= j2 < w and grid[i2][j2] == \"#\":\n                    ok = True\n                    break\n            if not ok:\n                return False\n    return True\n\n\nprint(\"Yes\" if solve() else \"No\")\n", "passed": true, "time": 0.21, "memory": 14164.0, "status": "done"}, {"code": "import re\nimport sys\nimport math\nimport itertools\nimport bisect\nfrom copy import copy\nfrom collections import deque,Counter\nfrom decimal import Decimal\nimport functools\ndef v(): return input()\ndef k(): return int(input())\ndef S(): return input().split()\ndef I(): return list(map(int,input().split()))\ndef X(): return list(input())\ndef L(): return list(input().split())\ndef l(): return list(map(int,input().split()))\ndef lcm(a,b): return a*b//math.gcd(a,b)\nsys.setrecursionlimit(10 ** 6)\nmod = 10**9+7\ncnt = 0\nans = 0\ninf = float(\"inf\")\nal = \"abcdefghijklmnopqrstuvwxyz\"\nAL = al.upper()\n\nH, W = I()\n\npad_s = ['.'*(W+2)]\nfor h in range(H):\n  pad_s.append('.' + input() + '.')\npad_s.append('.'*(W+2))\n\nfor i,ss in enumerate(pad_s):\n  for j,s in enumerate(ss):\n    if s == '#'\\\n      and pad_s[i][j+1] == '.'\\\n      and pad_s[i][j-1] == '.'\\\n      and pad_s[i+1][j] == '.'\\\n      and pad_s[i-1][j] == '.':\n      print('No')\n      return\n\nprint('Yes')\n", "passed": true, "time": 0.15, "memory": 14264.0, "status": "done"}, {"code": "h, w = map(int, input().split())\nc = tuple(tuple(0 if i == \".\" else 1 for i in input()) for _ in range(h))\n\nfor i in range(h):\n    for j in range(w):\n        if c[i][j]:\n            T = c[i-1][j] if 0 <= i - 1 else 0\n            B = c[i+1][j] if i + 1 < h else 0\n            L = c[i][j-1] if 0 <= j - 1 else 0\n            R = c[i][j+1] if j + 1 < w else 0\n\n            if not (T or B or L or R):\n                print(\"No\")\n                break\n    else:\n        continue\n    break\nelse:\n    print(\"Yes\")", "passed": true, "time": 0.18, "memory": 14136.0, "status": "done"}, {"code": "h, w = list(map(int, input().split()))\ns = [input() for _ in range(h)]\n\ndh = [0, 1, 0, -1]\ndw = [1, 0, -1, 0]\nflag = 0\n\nfor i in range(h):\n    for j in range(w):\n        if s[i][j] == '#':\n            cnt = 0\n            for p in range(4):\n                if i + dh[p] < 0 or i + dh[p] >= h or j + dw[p] < 0 or j + dw[p] >= w:\n                    continue\n                else:\n                    if s[i + dh[p]][j + dw[p]] == '#':\n                        cnt += 1\n            if cnt == 0:\n                flag = 1\n                break\n        if flag == 1:\n            break\n    if flag == 1:\n        print('No')\n        break\nelse:\n    print('Yes')\n        \n", "passed": true, "time": 0.3, "memory": 14108.0, "status": "done"}, {"code": "h, w = map(int, input().split())\n\ns = []\nfor i in range(h):\n    s.append('.' + input() + '.')\n\ns = ['.'* (w+2)]  + s + ['.'*(w+2)]\n\nans = 'Yes'\n\nfor i in range(1,h):\n    for j in range(1,w):\n        if s[i][j] == '#':\n            u = s[i - 1][j]\n            d = s[i + 1][j]\n            l = s[i][j - 1]\n            r = s[i][j + 1]\n            if u == '.' and d == '.' and l == '.' and r == '.':\n                ans = 'No'\n\nprint(ans)", "passed": true, "time": 0.15, "memory": 14120.0, "status": "done"}, {"code": "h,w=list(map(int,input().split()))\nmasu=[]\nmasu.append([])\nfor i in range(w+2):\n  masu[0].append('.')\nfor i in range(h):\n  masu.append([])\n  masu[i+1].append('.')\n  yoko=input()\n  for j in range(w):\n    masu[i+1].append(yoko[j])\nfor i in range(w+2):\n  masu[0].append('.')\nfor i in range(1,h-1):\n  for j in range(1,w-1):\n    if masu[i][j]=='#':\n      if masu[i][j+1]=='.' and masu[i][j-1]=='.' and masu[i+1][j]=='.' and masu[i-1][j]=='.':\n        print('No')\n        return\nprint('Yes')", "passed": true, "time": 0.14, "memory": 14372.0, "status": "done"}, {"code": "H, W = map(int,input().split())\nS = [list(input()) for i in range(H)]\n\nfor h in range(H):\n    for w in range(W):\n        if S[h][w] in ['.', 'B']: continue\n        \n        ary = [[0,1], [0,-1], [1,0], [-1,0]]\n        flag = False\n        for x, y in ary:\n            xd = h+x\n            yd = w+y\n            if xd < 0 or xd >= H or yd < 0 or yd >=W: continue\n            if S[xd][yd] in ['B', '#']:\n                S[h][w] = 'B'\n                S[xd][yd] = 'B'\n                flag = True\n        \n        if not flag:\n            print('No') \n            return\n\nprint('Yes')", "passed": true, "time": 0.22, "memory": 14136.0, "status": "done"}, {"code": "H,W = map(int,input().split())\nS = [[\".\"] * (W+2)]\nfor i in range(H):\n    S.append(list(\".\"+input().rstrip()+\".\"))\nS.append([\".\"]*(W+2))\n#print(S)\n\ndef checkaround(i,j):\n    dirc = [[0,1],[-1,0],[0,-1],[1,0]]\n    for d in dirc:\n        if S[i-d[0]][j-d[1]] == \"#\":\n            return True\n    return False\ndef main():\n    for i in range(1,H+1):\n        for j in range(1,W+1):\n            if S[i][j] == \"#\":\n                if not checkaround(i,j):\n                    print(\"No\")\n                    return\n    print(\"Yes\")\n\nmain()", "passed": true, "time": 0.14, "memory": 14084.0, "status": "done"}, {"code": "H, W = map(int, input().split())\ngrid = [input() for _ in range(H)]\n\nflg = True\nfor i in range(H):\n    for j in range(W):\n        if grid[i][j] == '.':\n            continue\n\n        flg2 = False\n        if j > 0 and grid[i][j - 1] == '#': flg2 = True\n        if j < W - 1 and grid[i][j + 1] == '#': flg2 = True\n        if i > 0 and grid[i - 1][j] == '#': flg2 = True\n        if i < H - 1 and grid[i + 1][j] == '#': flg2 = True\n\n        if not flg2:\n            flg = False\n\nprint(['No', 'Yes'][flg])", "passed": true, "time": 0.91, "memory": 14352.0, "status": "done"}, {"code": "H,W = map(int,input().split())\nfield = []\nfor h in range(H):\n  field.append(list(input()))\n\ndx = [0, 0, 1, -1]\ndy = [1, -1, 0, 0]\nans = 'Yes'\nfor h in range(H):\n  for w in range(W):\n    if field[h][w] != '#':\n      continue\n    ok = False\n    for i in range(4):\n      nw = dx[i] + w\n      nh = dy[i] + h\n      if nw < 0 or W <= nw or nh < 0 or H <= nh:\n        continue\n      if field[nh][nw] == '#':\n        ok = True\n    if not ok:\n      ans = 'No'\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14252.0, "status": "done"}, {"code": "H,W=list(map(int,input().split()))\n\nsq=[list(input()) for i in range(H)]\n\nfor i in range(H):\n    for j in range(W):\n        if sq[i][j]==\"#\":\n            temp=0\n            if j!=0:\n                if sq[i][j-1]==\"#\":\n                    temp+=1\n            if j!=W-1:\n                if sq[i][j+1]==\"#\":\n                    temp+=1\n            if i!=0:\n                if sq[i-1][j]==\"#\":\n                    temp+=1\n            if i!=H-1:\n                if sq[i+1][j]==\"#\":\n                    temp+=1\n            if temp==0:\n                print(\"No\")\n                return\n\nprint(\"Yes\")\n", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "#\u4e0a\u4e0b\u5de6\u53f3\u306b#\u304c\u5168\u3066\u96a3\u63a5\u3057\u3066\u3044\u308b\u306a\u3089OK\n\nN, M = map(int, input().split())\n#print(N)\nc = 0\nl = []\nfor i in range(N):\n  l.append(list(input()))\n  \n#print(l)\nN -= 1\nM -= 1\n\nfor i in range(N):\n  for j in range(M):\n    if l[i][j] == \".\":\n      pass\n    else:\n      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] == \".\":\n        c+=1\n      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] == \".\":\n        c+=1\n      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] == \".\":\n        c+=1\n      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] == \".\":\n        c+=1\n      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] == \".\":\n        c+=1\n      if i==0 and j==0 and l[i+1][j] == \".\" and l[i][j+1] == \".\":\n        c+=1\n      if i==0 and j==M and l[i+1][j] == \".\" and l[i][j-1] == \".\":\n        c+=1\n      if i==N and j==0 and l[i-1][j] == \".\" and l[i][j+1] == \".\":\n        c+=1\n      if i==N and j==M and l[i-1][j] == \".\" and l[i][j-1] == \".\":\n        c+=1\n\nif c == 0:\n  print(\"Yes\")\nelse:\n  print(\"No\")", "passed": true, "time": 0.18, "memory": 14240.0, "status": "done"}, {"code": "from itertools import product\nH,W=map(int,input().split())\nS=[input() for i in range(H)]\n\nisOK=True\n\nfor y,x in product(range(H),range(W)):\n    if S[y][x]=='.':\n        continue\n    sum=0\n\n    if 0<x:\n        if S[y][x-1]=='#':sum+=1\n    \n    if x<W-1:\n        if S[y][x+1]=='#':sum+=1\n    \n    if 0<y:\n        if S[y-1][x]=='#':sum+=1\n    \n    if y<H-1:\n        if S[y+1][x]=='#':sum+=1\n    \n    if sum==0:\n        isOK=False\n\nif isOK:\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.14, "memory": 14124.0, "status": "done"}, {"code": "H,W = list(map(int,input().split()))\n\nS = [input() for i in range(H)]\n\nfor i in range(H):\n  for j in range(W):\n    if S[i][j] != \"#\":\n      continue\n    for y,x in ((0,1),(0,-1),(1,0),(-1,0)):\n      if 0 <= i + y < H and 0 <= j + x < W:\n        if S[i + y][j + x] == \"#\":\n          break\n    else:\n      print(\"No\")\n      return\nprint(\"Yes\")\n", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "H,W = list(map(int,input().split()))\nGrid = [[\".\"]*(W+2)]\nfor i in range(H):\n    Grid.append(list(\".\" + str(input()) + \".\"))\n    \nGrid.append([\".\"]*(W+2))\nfor k in range(1,H+1):\n  for l in range(1,W+1):\n    moji = Grid[k][l]\n    if moji == \"#\":\n      flg = 0\n      for rec,col in ((1,0),(0,1),(-1,0),(0,-1)):\n        if Grid[k+rec][l+col] == \"#\":\n          Grid[k+rec][l+col] = \"b\"\n          flg = 1\n        elif Grid[k+rec][l+col] == \"b\":\n          flg = 1\n      \n      if flg == 1:\n        Grid[k][l] = \"b\"\n      else:\n        break\n  else:\n    continue\n  print(\"No\")\n  break    \nelse:\n  print(\"Yes\")\n        \n  \n", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "h,w = map(int, input().split())\ns = list()\nt = list()\na = [0 for i in range(w+2)]\ns.append(a)\nfor i in range(h):\n    b = str(input())\n    c = list(('0'+b+'0').replace('.','0').replace('#','1'))\n    d = list(map(int, c))\n    s.append(d)\n    t.append(b)\ns.append(a)\nflag = 0\n\nfor j in range(1,h+1):\n    for k in range(1,w+1):\n        if flag == 1:\n            break\n        if s[j][k] == 1:\n            cnt = 0\n            cnt = s[j-1][k] + s[j][k-1] + s[j][k+1] + s[j+1][k] \n            if cnt == 0:\n                flag = 1\n                print('No')\n\nif flag == 0:\n    print('Yes')", "passed": true, "time": 0.15, "memory": 14332.0, "status": "done"}, {"code": "H, W = list(map(int, input().split()))\nmasu = [[\".\" for _ in range(W+2)] for _ in range(H+2)]\n\nfor i in range(H):\n  masu[i+1][1:W+1] = input()\n  \nresult = [[0 for _ in range(W)] for _ in range(H)]\nfor i in range(1, H+1):\n  for j in range(1, W+1):\n    if masu[i][j] == '#':\n      x = masu[i-1][j]+masu[i][j-1]+masu[i][j+1]+masu[i+1][j]\n      if x.count(\"#\")==0:\n        print(\"No\")\n        return\n        \nprint(\"Yes\")\n\n", "passed": true, "time": 0.14, "memory": 14172.0, "status": "done"}, {"code": "H, W = map(int, input().split())\nL = ['.' + input() + '.' for _ in range(H)]\nL = ['.' * (W + 2)] + L + ['.' * (W + 2)]\nfor i in range(1, H + 1):\n  for j in range(1, W + 1):\n    if L[i][j] == \"#\":\n      l = [L[i-1][j], L[i+1][j], L[i][j-1], L[i][j+1]]\n      if '#' not in l:\n        print('No')\n        break\n  else:\n    continue\n  break\nelse:\n  print('Yes')", "passed": true, "time": 0.14, "memory": 14140.0, "status": "done"}, {"code": "H, W = map(int, input().split())\ngrid = []\nfor i in range(H):\n  grid.append([s for s in input()])\n \nfail_flg = False\nfor i in range(H):\n  if fail_flg:\n    break\n  for j in range(W):\n    r_ij = grid[i][j]\n    if r_ij == \".\":\n      continue\n    else:\n      c_ij = 0\n      if 0<=i<=H-1 and 1<=j<=W-1:\n        if grid[i][j-1] == \"#\":\n          c_ij += 1\n      if 0<=i<=H-1 and 0<=j<=W-2:\n        if grid[i][j+1] == \"#\":\n          c_ij += 1\n      if 1<=i<=H-1 and 0<=j<=W-1:\n        if grid[i-1][j] == \"#\":\n          c_ij += 1\n      if 0<=i<=H-2 and 0<=j<=W-1:\n        if grid[i+1][j] == \"#\":\n          c_ij += 1\n      if c_ij == 0:\n        fail_flg = True\n        break\n \nif fail_flg:\n  print(\"No\")\nelse:\n  print(\"Yes\")", "passed": true, "time": 0.15, "memory": 14084.0, "status": "done"}, {"code": "H,W = map(int,input().split())\ns = [list(input()) for _ in range(H)]\n\njougesayuu = [(-1,0),(1,0),(0,-1),(0,1)]\n\ncheck = True\nfor i in range(H):\n  for j in range(W):\n    if s[i][j] == \"#\":\n      flag = False\n      for (n,m) in jougesayuu:\n        ni, nj = i + n, j + m\n        if ni < 0 or H <= ni or nj < 0 or W <= nj:\n          continue\n        if s[ni][nj] == \"#\":\n          flag = True\n      if not flag:\n        check = False\n        \nprint(\"Yes\" if check else \"No\")", "passed": true, "time": 0.14, "memory": 14108.0, "status": "done"}, {"code": "h,w = map(int,input().split())\ns = [list(input()) for _ in range(h)]\nfor i in range(h):\n    for j in range(w):\n        if s[i][j] == \"#\":\n            c = 0\n            for ni, nj in [(i+1, j),(i, j+1),(i-1, j),(i, j-1)]:\n                if 0 <= ni < h and 0 <= nj < w and s[ni][nj] == \"#\":\n                    c += 1\n            if c == 0:\n                print(\"No\")\n                return\nprint(\"Yes\")", "passed": true, "time": 0.14, "memory": 14320.0, "status": "done"}, {"code": "H,W=list(map(int,input().split()))\ns=[input() for _ in range(H)]\ncells=[(i,j) for i in range(H) for j in range(W)]\ndi=[1,0,-1,0]\ndj=[0,1,0,-1]\n\nfor i,j in cells:\n    if s[i][j]=='.':\n        continue\n    flag=False\n    for k in range(4):\n        ni=i+di[k]\n        nj=j+dj[k]\n        if ni<0 or nj<0 or ni>=H or nj>=W:\n            continue\n        if s[ni][nj]=='#':\n            flag=True\n    if not flag:\n        print(\"No\")\n        break\nelse:\n    print(\"Yes\")\n", "passed": true, "time": 0.14, "memory": 14216.0, "status": "done"}, {"code": "h, w = map(int, input().split())\nc = [input() for _ in range(h)]\n\nans = 'Yes'\n\nfor i in range(h):\n    for j in range(w):\n        if c[i][j] == \"#\":\n            upper = c[i - 1][j] == \"#\" if 0 <= i - 1 else False\n            lower = c[i + 1][j] == \"#\" if i + 1 < h else False\n            left = c[i][j - 1] == \"#\" if 0 <= j - 1 else False\n            right = c[i][j + 1] == \"#\" if j + 1 < w else False\n\n            if not (upper or lower or left or right):\n                ans = 'No'\n                break\n    else:\n        continue\n    break\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14336.0, "status": "done"}, {"code": "H, W = list(map(int, input().split()))\nm = [] \n\nfor i in range(H):\n  s=input()\n  t = []\n  for i in s:\n    t.append(1 if i == \"#\" else 0)\n  m.append(t)\n  \nfor i in range(H):\n  for j in range(W):\n    if m[i][j] == 0:\n      continue\n    count = 0\n    if i !=0 :\n      count += m[i-1][j]\n    if i != H-1:\n      count += m[i+1][j]\n    if j != 0:\n      count += m[i][j-1]\n    if j != W-1:\n      count += m[i][j+1]\n    if count > 0:\n      continue\n    else:\n      print(\"No\")\n      return\nprint(\"Yes\")\n\n    \n", "passed": true, "time": 0.14, "memory": 14136.0, "status": "done"}, {"code": "H,W = map(int,input().split())\ngrid = []\nans = \"Yes\"\n\nfor _ in range(H):\n  grid_i = input().split()\n  grid.append(grid_i[0])\n\nfor i in range(H):\n  for j in range(W):\n    if grid[i][j] == \"#\":\n      X = \"NG\"\n      if (i-1 >= 0 and grid[i-1][j] == \".\") or i < 1:\n        None\n      else:\n        X = \"OK\"\n      if (j-1 >= 0 and grid[i][j-1] == \".\") or j < 1:\n        None\n      else:\n        X = \"OK\"\n      if (i+1 < H and grid[i+1][j] == \".\") or i+1 >= H:\n        None\n      else:\n        X = \"OK\"\n      if (j+1 < W and grid[i][j+1] == \".\") or j+1 >= W:\n        None\n      else:\n        X = \"OK\"\n      if X == \"NG\":\n        ans = \"No\"\n\nprint(ans)", "passed": true, "time": 0.15, "memory": 14336.0, "status": "done"}, {"code": "h,w = list(map(int,input().split()))\ns = [list(input()) for _ in range(h)]\n\ndxy = [(1,0),(0,1),(-1,0),(0,-1)]\nans = True\nfor i in range(h):\n    for j in range(w):\n        cnt = 0\n        if s[i][j]==\"#\":\n            for p,q in dxy:\n                if not(0<=i+p<h and 0<=j+q<w):\n                    cnt += 1 \n                    continue\n                elif s[i+p][j+q] == \".\":\n                    cnt += 1\n                else:\n                    continue\n        if cnt == 4:\n            ans = False\nprint((\"Yes\" if ans==True else \"No\"))\n\n", "passed": true, "time": 0.23, "memory": 14264.0, "status": "done"}, {"code": "import sys\n\ninput = sys.stdin.readline\n\ndef main():\n    H, W = list(map(int, input().split()))\n    field = []\n    for _ in range(H):\n        tmp = list(input()[:-1])\n        field.append(tmp)\n    \n    # import\n    from collections import deque\n    \n    # digtmp\n    digtmp = [(0, 1), (1, 0), (0, -1), (-1, 0)]\n    #digtmp = [(0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1), (1, 0), (1, 1)]\n    \n    # BFS\n    # please prefer objects:\n    #  H: height.\n    #  W: width\n    #  field: maze field made of '.', '#'.\n    #  check: check field\n    for h in range(H):\n        for w in range(W):\n            a, b = h, w\n            flag = False\n            if field[a][b] == '.':\n                continue\n            for dx, dy in digtmp:\n                x = a + dx\n                y = b + dy\n                if not (0 <= x < H and 0 <= y < W):\n                    continue\n                if field[x][y] == '#':\n                    flag = True\n                    continue\n            if not flag:\n                print('No')\n                return\n    print('Yes')\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.15, "memory": 14184.0, "status": "done"}, {"code": "h, w = list(map(int, input().split()))\ntable = [list(input()) for _ in range(h)]\n\nmx = [0, 1, 0, -1]#y\u3068\u306e\u517c\u306d\u5408\u3044\u3067\u7247\u65b9\u306f0\u306b\u3057\u3066\u4e0a\u4e0b\u5de6\u53f3\u5224\u5b9a\nmy = [1, 0, -1, 0]#x\u3068\u306e\u517c\u306d\u5408\u3044\u3067\u7247\u65b9\u306f0\u306b\u3057\u3066\u4e0a\u4e0b\u5de6\u53f3\u5224\u5b9a\nfor i in range(h):\n    for j in range(w):\n        if table[i][j] == \"#\":\n            for k in range(4):\n                tx = j + mx[k]#\u5de6\u53f3\u5224\u5b9a\n                ty = i + my[k]#\u4e0a\u4e0b\u5224\u5b9a\n                if 0 <= tx < w and 0 <= ty < h and table[ty][tx] == \"#\":#\u6dfb\u3048\u5b57\u306b\u4f7f\u3048\u308b\u304b\u5224\u5b9a\u3057\u3066\u3044\u308b\n                    break\n            else:#break\u3055\u308c\u306a\u304b\u3063\u305f\u6642\u5b9f\u884c\u3055\u308c\u308b\u3001\u4e0a\u4e0b\u5de6\u53f3\u306b#\u304c\u306a\u304b\u3063\u305f\u6642\u306b\u306a\u308b\n                print(\"No\")\n                return\nprint(\"Yes\")\n\n", "passed": true, "time": 0.25, "memory": 14308.0, "status": "done"}, {"code": "import sys\n\nH, W = list(map(int, input().split()))\nS = [list(sys.stdin.readline().strip()) for _ in range(H)]\n\ndx = [1, 0, -1, 0]\ndy = [0, -1, 0, 1]\n\nfor i, row in enumerate(S):\n    for j, s in enumerate(row):\n        if s == \".\":\n            continue\n        ok = False\n        for k in range(4):\n            nx = j + dx[k]\n            ny = i + dy[k]\n            if not(0 <= nx < W and 0 <= ny < H):\n                continue\n            if S[ny][nx] == \"#\":\n                ok = True\n        if ok is False:\n            print(\"No\")\n            return\n\nprint(\"Yes\")\n", "passed": true, "time": 0.14, "memory": 14184.0, "status": "done"}, {"code": "H,W=map(int,input().split())\nList = [list(input()) for i in range(H)]\nres = \"Yes\"\nflag = True\n\ndef checkAround(ListX,i,j):\n  if i == 0 and j ==0:\n    if List[i+1][j] == \"#\" or List[i][j+1] == \"#\":\n      return True\n    else: \n      return False\n  elif i == 0 and j !=0 and j != W-1:\n    if List[i+1][j] == \"#\" or List[i][j-1] == \"#\" or List[i][j+1] == \"#\":\n      return True\n    else: \n      return False\n  elif i == 0 and j == W-1:\n    if List[i+1][j] == \"#\" or List[i][j-1] == \"#\":\n      return True\n    else: \n      return False\n  elif i != 0 and i != H-1 and j == 0:\n    if List[i+1][j] == \"#\" or List[i-1][j] == \"#\" or List[i][j+1] == \"#\":\n      return True\n    else: \n      return False\n  elif i == H-1 and j == W-1:\n    if List[i-1][j] == \"#\" or List[i][j-1] == \"#\":\n      return True\n    else: \n      return False\n  elif i == H-1 and j !=0 and j != W-1:\n    if List[i-1][j] == \"#\" or List[i][j+1] == \"#\" or List[i][j-1] == \"#\":\n      return True\n    else: \n      return False\n  elif i == H-1 and j == 0:\n    if List[i-1][j] == \"#\" or List[i][j-1] == \"#\":\n      return True\n    else: \n      return False\n  elif i != 0 and i != H-1 and j == W-1:\n    if List[i+1][j] == \"#\" or List[i-1][j] == \"#\" or List[i][j-1] == \"#\":\n      return True\n    else: \n      return False\n  else:\n    if List[i+1][j] == \"#\" or List[i-1][j] == \"#\" or List[i][j-1] == \"#\" or List[i][j+1] == \"#\":\n      return True\n    else: \n      return False\n\nfor k in range(H):\n  for l in range(W):\n    if List[k][l] == \".\":\n      pass\n    else:\n      flag = checkAround(List,k,l)\n      if not flag:\n        res = \"No\"\n        break\n  if not flag:\n    break\nprint(res)", "passed": true, "time": 0.22, "memory": 14196.0, "status": "done"}, {"code": "h, w = list(map(int, input().split()))\n\nans = 'Yes'\n\n\n\ns = []\nfor i in range(h):\n    s += input().split()\n\n# \u7aef\u306e\u51e6\u7406\u3092\u697d\u306b\u3059\u308b\u305f\u3081\u306b\u5468\u308a\u3092 . \u3067\u57cb\u3081\u308b\n## \u4e0a\u7aef\ns.insert(0, ''.join(['.'] * (w + 2)))\n## \u4e21\u7aef\ns = list(map(lambda x: '.' + x + '.', s))\n## \u4e0b\u7aef\ns.insert(len(s), ''.join(['.'] * (w + 2)))\n\n# 1\u6587\u5b57\u305a\u3064\u30ea\u30b9\u30c8\u306b\u3059\u308b\ns = list(map(list, s))\n\n# 50 * 50\nfor i in range(1, h + 1):\n    for j in range(1, w + 1):\n        if s[i][j] == '#':\n            # \u4e0a\u4e0b\u5de6\u53f3\u3092\u30c1\u30a7\u30c3\u30af\n            # \u4ef2\u9593\u304c\u3044\u308b\u6642False\u3001\u5b64\u7acb\u3057\u3066\u3044\u308b\u3068\u304dTrue\n            flg_up = False if s[i-1][j] == '#' else True\n            flg_down = False if s[i+1][j] == '#' else True\n            flg_left = False if s[i][j-1] == '#' else True\n            flg_right = False if s[i][j+1] == '#' else True\n            \n            # 1\u3064\u3067\u3082\u5b64\u7acb\u3067\u306a\u3044\u30d5\u30e9\u30b0\u304c\u3042\u308c\u3070\u5b64\u7acb\u3067\u306a\u3044\u306e\u3067False\u3001\u5168\u90e8\u5b64\u7acb\u306e\u6642True\n            if flg_up & flg_down & flg_left & flg_right:\n                ans = 'No'\n                break\n    else:\n        continue\n    break\n\nprint(ans)", "passed": true, "time": 0.22, "memory": 14112.0, "status": "done"}, {"code": "h,w = map(int,input().split())\ns = [list(input()) for i in range(h)]\n\nfor i in range(h):\n    s[i].insert(0,'.')\n    s[i].append('.')\n\ns.insert(0,['.']*(w+2))\ns.append(['.']*(w+2))\n\nflag = True\nfor i in range(1,h+1):\n    for j in range(1,w+1):\n        if s[i][j] == '#':\n            if     s[i-1][j] == '#' \\\n                or s[i+1][j] == '#' \\\n                or s[i][j-1] == '#' \\\n                or s[i][j+1] == '#':\n                continue\n            else:\n                flag = False\n                break\n    if flag == False:\n        print('No')\n        break\nelse:\n    print('Yes')", "passed": true, "time": 0.14, "memory": 14228.0, "status": "done"}, {"code": "h, w = list(map(int, input().split()))\n\nans = 'Yes'\n\ns = []\nfor i in range(h):\n    s += input().split()\n\n# 1\u6587\u5b57\u305a\u3064\u30ea\u30b9\u30c8\u306b\u3059\u308b\ns = list(map(list, s))\n\n# 50 * 50\nfor i in range(h):\n    for j in range(w):\n        if s[i][j] == '#':\n            # \u4e0a\u4e0b\u5de6\u53f3\u3092\u30c1\u30a7\u30c3\u30af\n            # \u4ef2\u9593\u304c\u3044\u308b\u6642False\u3001\u5b64\u7acb\u3057\u3066\u3044\u308b\u3068\u304dTrue\n            if i > 0:\n                flg_up = False if s[i-1][j] == '#' else True\n            else:\n                flg_up = True\n            \n            if i < h - 1:\n                flg_down = False if s[i+1][j] == '#' else True\n            else:\n                flg_down = True\n            \n            if j > 0:\n                flg_left = False if s[i][j-1] == '#' else True\n            else:\n                flg_left = True\n            \n            if j < w - 1:\n                flg_right = False if s[i][j+1] == '#' else True\n            else:\n                flg_right = True\n            \n            # 1\u3064\u3067\u3082\u5b64\u7acb\u3067\u306a\u3044\u30d5\u30e9\u30b0\u304c\u3042\u308c\u3070\u5b64\u7acb\u3067\u306a\u3044\u306e\u3067False\u3001\u5168\u90e8\u5b64\u7acb\u306e\u6642True\n            if flg_up & flg_down & flg_left & flg_right:\n                ans = 'No'\n                break\n    else:\n        continue\n    break\n\nprint(ans)", "passed": true, "time": 0.15, "memory": 14288.0, "status": "done"}, {"code": "h,w=map(int,input().split())\ns=[input() for i in range(h)]\nfor i in range(1,h-1):\n  for j in range(1,w-1):\n    if s[i][j]=='#':\n      if (s[i+1][j]=='#' or s[i-1][j]=='#' or s[i][j+1]=='#' or s[i][j-1]=='#'):\n        continue\n      else:\n        print('No')\n        return\nprint('Yes')", "passed": true, "time": 0.14, "memory": 14260.0, "status": "done"}, {"code": "h,w=map(int,input().split()) \nl = [input() for _ in range(h)]\ndx = [1,-1,0,0]\ndy = [0,0,1,-1]\nfor i in range(h):\n    for j in range(w):\n        if l[i][j] =='#':\n            cnt = 0\n            for di in range(4):\n                y = i+dx[di]\n                x = j+dy[di]\n                if x<0 or y<0 or x>w-1 or y>h-1:\n                    continue\n                else:\n                    if l[y][x] =='#':\n                        cnt +=1\n            if cnt == 0:\n                print('No')\n                return\n\nprint('Yes')", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "h, w = list(map(int, input().split()))\n\nans = 'Yes'\n\ns = []\nfor i in range(h):\n    s += input().split()\n\n# \u7aef\u306e\u51e6\u7406\u3092\u697d\u306b\u3059\u308b\u305f\u3081\u306b\u5468\u308a\u3092 . \u3067\u57cb\u3081\u308b\n#   ..........\n#   .#.#.#.#..\n#   ..##.###..\n#   .....##.#.\n#   ...##...#.\n#   ..####..#.\n#   ..........\n\n## \u4e0a\u7aef\ns.insert(0, ''.join(['.'] * (w + 2)))\n## \u4e21\u7aef\ns = list(map(lambda x: '.' + x + '.', s))\n## \u4e0b\u7aef\ns.insert(len(s), ''.join(['.'] * (w + 2)))\n\n# 1\u6587\u5b57\u305a\u3064\u30ea\u30b9\u30c8\u306b\u3059\u308b\ns = list(map(list, s))\n\n# 50 * 50\nfor i in range(1, h + 1):\n    for j in range(1, w + 1):\n        if s[i][j] == '#':\n            # \u4e0a\u4e0b\u5de6\u53f3\u3092\u30c1\u30a7\u30c3\u30af\n            # \u4ef2\u9593\u304c\u3044\u308b\u6642False\u3001\u5b64\u7acb\u3057\u3066\u3044\u308b\u3068\u304dTrue\n            #flg_up = False if s[i-1][j] == '#' else True\n            #flg_down = False if s[i+1][j] == '#' else True\n            #flg_left = False if s[i][j-1] == '#' else True\n            #flg_right = False if s[i][j+1] == '#' else True\n            flg_up = True if s[i-1][j] == '.' else False\n            flg_down = True if s[i+1][j] == '.' else False\n            flg_left = True if s[i][j-1] == '.' else False\n            flg_right = True if s[i][j+1] == '.' else False\n            \n            # 1\u3064\u3067\u3082\u5b64\u7acb\u3067\u306a\u3044\u30d5\u30e9\u30b0\u304c\u3042\u308c\u3070\u5b64\u7acb\u3067\u306a\u3044\u306e\u3067False\u3001\u5168\u90e8\u5b64\u7acb\u306e\u6642True\n            if flg_up & flg_down & flg_left & flg_right:\n                ans = 'No'\n                break\n    else:\n        continue\n    break\n\nprint(ans)", "passed": true, "time": 0.15, "memory": 14116.0, "status": "done"}, {"code": "H,W = list(map(int,input().split()))\nL = [list(input()) for _ in range(H)]\nfor i in range(H):\n    for j in range(W):\n        if L[i][j] == '#':\n            if i != 0 and L[i-1][j] == '#':\n                continue\n            if i != H-1 and L[i+1][j] == '#':\n                continue\n            if j != 0 and L[i][j-1] == '#':\n                continue\n            if j != W-1 and L[i][j+1] == '#':\n                continue\n            print('No')\n            return\nprint('Yes')\n", "passed": true, "time": 0.24, "memory": 13948.0, "status": "done"}, {"code": "\nh, w = list(map(int, input().split()))\ns = [input() for _ in range(h)]\n\nfor i in range(h):\n    for j in range(w):\n        if s[i][j] == '.':\n            continue\n        ok = False\n        for dx, dy in [(1, 0), (0, 1), (0, -1), (-1, 0)]:\n            nx = j + dx\n            ny = i + dy\n            if 0 <= nx < w and 0 <= ny < h and s[ny][nx] == '#':\n                ok = True\n        if not ok:\n            print('No')\n            return\nprint('Yes')\n", "passed": true, "time": 0.15, "memory": 14092.0, "status": "done"}, {"code": "H,W = list(map(int,input().split()))\n\nS = [\".\" * (W + 2)] * (H + 2)\n\nfor i in range(H):\n  S[i + 1] = \".\" + input() + \".\"\n\nfor i in range(1, H + 1):\n  for j in range(1, W + 1):\n    if S[i][j] == \"#\":\n      for x,y in ((0,1),(0,-1),(1,0),(-1,0)):\n        if S[i + x][j + y] == \"#\":\n          break\n      else:\n        print(\"No\")\n        return\nprint(\"Yes\")\n", "passed": true, "time": 0.23, "memory": 14264.0, "status": "done"}, {"code": "H,W = list(map(int, input().split()))\ns = [input() for _ in range(H)]\n\nimport sys\nfor j in range(1,H-1):\n    for i in range(1,W-1):\n        if s[j][i] =='#':\n            if s[j][i-1] == '#':\n                pass\n            elif s[j-1][i] == '#':\n                pass\n            elif s[j][i+1] == '#':\n                pass\n            elif s[j+1][i] == '#':\n                pass\n            else:\n                print('No')\n                return\nprint('Yes')\n", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "H,W = input().split()\n\ndummy_list = ['.'] *(int(W)+2)\nsquare_list=[]\nsquare_list.append(dummy_list)\nfor i in range(int(H)):\n  wide_list = ['.']\n  wide_list=wide_list + list(input())\n  wide_list.append('.')\n  square_list.append(wide_list)\nsquare_list.append(dummy_list)\nans = 'Yes'\nfor i in range(1,int(H)+1):\n  for j in range(1,int(W)+1):\n\n    before_list = square_list[i-1]\n    center_list = square_list[i]\n    after_list = square_list[i+1]\n    if center_list[j] == '.':\n      continue\n    if before_list[j] == '.' and center_list[j-1] == '.' and center_list[j + 1] == '.' and after_list[j] == '.':\n      ans = 'No'\n\nprint(ans)", "passed": true, "time": 0.24, "memory": 13908.0, "status": "done"}, {"code": "import sys\n\ndef check(i,j,s_list,h,w):\n    uesita_list = [-1,1]\n    sayuu_list = [-1,1]\n\n    for uesita in uesita_list:\n        new_i = i + uesita\n        if new_i < 0 or new_i > h-1:\n            continue\n        if s_list[new_i][j] == \"#\":\n            return True\n\n    for sayuu in sayuu_list:\n        new_j = j + sayuu\n        if new_j > w-1 or new_j < 0:\n            continue\n        if s_list[i][new_j] == \"#\":\n            return True\n    \n    return False            \n\n\ninput = sys.stdin.readline\n\nh, w= list(map(int, input().split()))\n\ns_list = [[0 for _ in range(w)] for _ in range(h)]\nfor i in range(h):\n    w_s_list = input()\n    w_s_list = w_s_list.replace('\\n','')\n    w_s_list = list(w_s_list)\n    for j in range(w):\n        s_list[i][j] = w_s_list[j]\n\n\nfor i in range(h):\n    for j in range(w):\n        s = s_list[i][j]\n        if s == \"#\":\n            ok_flag = check(i,j,s_list,h,w)\n            if not ok_flag:\n                print(\"No\")\n                return\n\nprint(\"Yes\")\n\n\n", "passed": true, "time": 0.14, "memory": 14312.0, "status": "done"}, {"code": "# coding: utf-8\n\n\ndef main():\n    H, W = list(map(int, input().split()))\n    ans = 'Yes'\n    grid = [['*'] * (W + 2) for _ in range(H + 2)]\n    dir = [[1, 0], [-1, 0], [0, 1], [0, -1]]\n    for i in range(H):\n        S = list(input())\n        for j in range(W):\n            grid[i + 1][j + 1] = S[j]\n    \n    for i in range(H):\n        for j in range(W):\n            if grid[i + 1][j + 1] == '#':\n                flg = True\n                for x, y in dir:\n                    if grid[i + 1 + x][j + 1 + y] == '#':\n                        flg = False\n                if flg:\n                    ans = 'No'\n\n    print(ans)\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.15, "memory": 14100.0, "status": "done"}, {"code": "h, w = list(map(int, input().split()))\ntable = [list(input()) for _ in range(h)]\n\nmx = [0, 1, 0, -1]\nmy = [1, 0, -1, 0]\nfor i in range(h):\n    for j in range(w):\n        if table[i][j] == \"#\":\n            for k in range(4):\n                tx, ty = j + mx[k], i + my[k]\n                if 0 <= tx < w and 0 <= ty < h and table[ty][tx] == \"#\":\n                    break\n            else:\n                print(\"No\")\n                return\nprint(\"Yes\")\n\n", "passed": true, "time": 0.14, "memory": 14236.0, "status": "done"}, {"code": "h, w = [int(x) for x in input().split()]\ns_list = [input() for _ in range(h)]\n\niso_flag = [[True] * w for _ in range(h)]\nfor i in range(h):\n    for j in range(w):\n        if s_list[i][j] == \".\":\n            continue\n\n        flag_r = True\n        if j < w - 1 and s_list[i][j + 1] == \"#\":\n            flag_r = iso_flag[i][j + 1] = False\n        \n        flag_d = True\n        if i < h - 1 and s_list[i + 1][j] == \"#\":\n            flag_d = iso_flag[i + 1][j] = False\n        \n        if iso_flag[i][j] and flag_r and flag_d:\n            print(\"No\")\n            return\nprint(\"Yes\")", "passed": true, "time": 0.14, "memory": 14184.0, "status": "done"}, {"code": "from itertools import product\nH,W=map(int,input().split())\nS=[input() for i in range(H)]\n \nisOK=True\n \nfor y,x in product(range(H),range(W)):\n    if S[y][x]=='.':\n        continue\n    sum=0\n \n    if 0<x:\n        if S[y][x-1]=='#':sum+=1\n    \n    if x<W-1:\n        if S[y][x+1]=='#':sum+=1\n    \n    if 0<y:\n        if S[y-1][x]=='#':sum+=1\n    \n    if y<H-1:\n        if S[y+1][x]=='#':sum+=1\n    \n    if sum==0:\n        isOK=False\n \nif isOK:\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.14, "memory": 14156.0, "status": "done"}, {"code": "h, w = list(map(int, input().split()))\ns = ['.' + input() + '.' for _ in range(h)]\ns = ['.' * (w + 2)] + s + ['.' * (w + 2)]\n\nfor y in range(1, h + 1):\n    for x in range(1, w + 1):\n        if s[y][x] == '#' and all(s[y + dy][x + dx] == '.' for dy, dx in [(1, 0), (0, 1), (-1, 0), (0, -1)]):\n            print('No')\n            return\nprint('Yes')\n", "passed": true, "time": 0.14, "memory": 14240.0, "status": "done"}, {"code": "import sys\nH, W = list(map(int, input().split()))\nl = []\n\nfor i in range(H):\n    l.append(list(input()))\n\nfor i in range(H):\n    for j in range(W):\n        \n        if l[i][j] == '.':\n            pass\n        else:\n            count = 0\n            if i > 0 and l[i-1][j] == '#':\n                    count += 1 #\u4e0a\u65b9\u5411\n            if i < (H-1) and l[i+1][j] == '#':\n                count += 1     #\u4e0b\u65b9\u5411\n            if j > 0 and l[i][j-1] == '#':\n                count += 1     #\u5de6\u65b9\u5411\n            if j < (W-1) and l[i][j+1] == '#':\n                count += 1     #\u53f3\u65b9\u5411\n            if count == 0:\n                print('No')\n                return\n                \nprint('Yes')\n", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "H,W = map(int, input().split())\ns = [input() for _ in range(H)]\n\nimport sys\nfor j in range(1,H-1):\n    for i in range(1,W-1):\n        if s[j][i] =='#':\n            if s[j][i-1] == '#':\n                pass\n            elif s[j-1][i] == '#':\n                pass\n            elif s[j][i+1] == '#':\n                pass\n            elif s[j+1][i] == '#':\n                pass\n            else:\n                print('No')\n                return\nprint('Yes')", "passed": true, "time": 0.14, "memory": 14200.0, "status": "done"}, {"code": "h, w = list(map(int, input().split()))\n\nans = 'Yes'\n\ns = []\nfor i in range(h):\n    s += input().split()\n\n# \u7aef\u306e\u51e6\u7406\u3092\u697d\u306b\u3059\u308b\u305f\u3081\u306b\u5468\u308a\u3092 . \u3067\u57cb\u3081\u308b\n#   ..........\n#   .#.#.#.#..\n#   ..##.###..\n#   .....##.#.\n#   ...##...#.\n#   ..####..#.\n#   ..........\n\n## \u4e0a\u7aef\ns.insert(0, ''.join(['.'] * (w + 2)))\n## \u4e21\u7aef\ns = list(map(lambda x: '.' + x + '.', s))\n## \u4e0b\u7aef\ns.insert(len(s), ''.join(['.'] * (w + 2)))\n\n# 1\u6587\u5b57\u305a\u3064\u30ea\u30b9\u30c8\u306b\u3059\u308b\ns = list(map(list, s))\n\n# 50 * 50\nfor i in range(1, h + 1):\n    for j in range(1, w + 1):\n        if s[i][j] == '#':\n            # \u4e0a\u4e0b\u5de6\u53f3\u3092\u30c1\u30a7\u30c3\u30af\n            # \u4ef2\u9593\u304c\u3044\u308b\u6642False\u3001\u5b64\u7acb\u3057\u3066\u3044\u308b\u3068\u304dTrue\n            #flg_up = False if s[i-1][j] == '#' else True\n            #flg_down = False if s[i+1][j] == '#' else True\n            #flg_left = False if s[i][j-1] == '#' else True\n            #flg_right = False if s[i][j+1] == '#' else True\n            flg_up = True if s[i-1][j] == '.' else False\n            flg_down = True if s[i+1][j] == '.' else False\n            flg_left = True if s[i][j-1] == '.' else False\n            flg_right = True if s[i][j+1] == '.' else False\n            \n            # 1\u3064\u3067\u3082\u5b64\u7acb\u3067\u306a\u3044\u30d5\u30e9\u30b0\u304c\u3042\u308c\u3070\u5b64\u7acb\u3067\u306a\u3044\u306e\u3067False\u3001\u5168\u90e8\u5b64\u7acb\u306e\u6642True\n            #if flg_up & flg_down & flg_left & flg_right:\n            if (s[i-1][j] == '.') & (s[i+1][j] == '.') & (s[i][j-1] == '.') & (s[i][j+1] == '.'):\n                ans = 'No'\n                break\n    else:\n        continue\n    break\n\nprint(ans)", "passed": true, "time": 0.15, "memory": 14308.0, "status": "done"}, {"code": "H,W  = map(int,input().split())\ns = []\nans = 'Yes'\nfor _ in range(H):\n    s.append(input())\n\nfor i in range(1,H-1):\n    for j in range(1,W-1):\n        if s[i][j]=='#' and s[i][j+1]==s[i+1][j]==s[i][j-1]==s[i-1][j]=='.':\n                print('No')\n                return\nprint(ans)", "passed": true, "time": 0.14, "memory": 14164.0, "status": "done"}, {"code": "h, w = map(int, input().split())\nsrc = [input() for i in range(h)]\n\nans = []\nfor row in src:\n        ans.append(list(row))\n\ndxy = [(1, 0), (-1, 0), (0, 1), (0, -1)]\nfor x in range(h):\n        for y in range(w):\n                if src[x][y] == \".\":\n                        continue\n                if src[x][y] == \"#\":\n                        flag = 0\n                        for dx, dy in dxy:\n                                if x + dx < 0 or x + dx > h -1 or y + dy < 0 or y + dy > w - 1:\n                                        continue\n                                if src[x + dx][y + dy] == \"#\":\n                                        flag = 1\n                                        break\n                        if flag == 0:\n                                print(\"No\")\n                                return\n\nprint(\"Yes\")", "passed": true, "time": 0.33, "memory": 14348.0, "status": "done"}, {"code": "h,w = map(int,input().split())\nF = [list(input()) for _ in range(h)]\n\nfor i in range(h):\n  for j in range(w):\n    cnt = 0\n    if F[i][j] == '#':\n      if 0 <= (i-1) < h: \n        if F[i-1][j] == '#': cnt += 1\n      if 0 <= (i+1) < h: \n        if F[i+1][j] == '#': cnt += 1\n      if 0 <= (j-1) < w:\n        if F[i][j-1] == '#': cnt += 1\n      if 0 <= (j+1) < w:\n        if F[i][j+1] == '#': cnt += 1\n      if cnt == 0:\n        print('No')\n        return\nprint('Yes')", "passed": true, "time": 0.14, "memory": 14316.0, "status": "done"}, {"code": "from sys import stdin, stdout # only need for big input\n\n\ndef solve():\n    h, w = list(map(int, input().split())) \n    grid = [] \n    for _ in range(h):\n        s = input()\n        assert(len(s) == w)\n        grid.append(s)\n\n    for i in range(h):\n        for j in range(w):\n            if grid[i][j] == '.':\n                continue\n\n            isolate = True\n            for px in [i-1, i + 1]:\n                    if px >= 0 and px < h: \n                        if grid[px][j] == '#':\n                            isolate = False\n            for py in [j-1, j + 1]:\n                if py >= 0 and py < w:\n                    if grid[i][py] == '#':\n                        isolate = False\n            if isolate:\n                print(\"No\")\n                return\n    \n    print(\"Yes\")\n\n\n    \n    \n\ndef main():\n    solve()\n\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.18, "memory": 14332.0, "status": "done"}, {"code": "h, w = map(int, input().split())\nc = [input() for _ in range(h)]\n\nans = 'Yes'\n\nfor i in range(h):\n    for j in range(w):\n        if c[i][j] == \"#\":\n            upper = c[i - 1][j] == \"#\" if 0 <= i - 1 else False\n            lower = c[i + 1][j] == \"#\" if i + 1 < h else False\n            left = c[i][j - 1] == \"#\" if 0 <= j - 1 else False\n            right = c[i][j + 1] == \"#\" if j + 1 < w else False\n\n            if not (upper or lower or left or right):\n                ans = 'No'\n                break\n\n\nprint(ans)", "passed": true, "time": 0.23, "memory": 14040.0, "status": "done"}, {"code": "import sys\nH,W = map(int,input().split())\nlsHW = [['.' for i in range(W+2)]]\nfor i in range(H):\n    Sls = ['.'] + list(input()) + ['.']\n    lsHW.append(Sls)\nlsHW.append(['.' for i in range(W+2)])\nfor i in range(1,H+1):\n    for j in range(1,W+1):\n        if lsHW[i][j] == '.':\n            continue\n        else:\n            if not (lsHW[i-1][j] == '#' or lsHW[i+1][j] == '#' or lsHW[i][j-1] == '#' or lsHW[i][j+1] == '#'):\n                print('No')\n                return\nprint('Yes')", "passed": true, "time": 0.17, "memory": 14128.0, "status": "done"}, {"code": "H, W = map(int, input().split())\nS = ['.' + input() + '.' for _ in range(H)]\nS = ['.'*(W+2)] + S + ['.'*(W+2)]\nflag = 0\nfor i in range(1, H+1):\n    for j in range(1,W+1):\n        if S[i][j] == '#':\n            if S[i-1][j] == '.' and S[i+1][j] == '.' and S[i][j-1] == '.' and S[i][j+1] == '.':\n                flag = 1\nprint('Yes' if flag == 0 else 'No')", "passed": true, "time": 0.18, "memory": 14272.0, "status": "done"}, {"code": "h,w = map(int,input().split())\ns = []\ns.append([\".\"] * (w+2))\nfor i in range(h):\n  s.append([a for a in input()])\n  s[i+1].insert(0, \".\")\n  s[i+1].append(\".\")\ns.append([\".\"] * (w+2))\ncheck = True\nfor j in range(1,h+1):\n  for k in range(1,w+1):\n    if s[j][k] == \"#\":\n      if s[j+1][k] == \".\" and s[j-1][k] == \".\" and s[j][k+1] == \".\" and s[j][k-1] == \".\":\n        check = False\nprint(\"Yes\" if check else \"No\")", "passed": true, "time": 0.23, "memory": 14140.0, "status": "done"}, {"code": "# \u4eca\u306e\u5ea7\u6a19\u306e\u8272\u304c#\u306e\u3068\u304d\u3001\u4e0a\u4e0b\u5de6\u53f3\u3044\u305a\u308c\u304b\u306b#\u304c\u3042\u308c\u3070\u304a\uff4b\nh, w = list(map(int, input().split()))\ntable = [input() for _ in range(h)]\nstep = [0, 1, 0, -1, 0]\nfor i in range(h):\n    for j in range(w):\n        if table[i][j] == \".\":\n            continue\n        flag = False\n        for k in range(4):\n            ny, nx = i + step[k], j + step[k + 1]\n            if nx < 0 or nx == w or ny < 0 or ny == h:\n                continue\n            if table[ny][nx] == \"#\":\n                flag = True\n        if flag == False:\n            print(\"No\")\n            return\nprint(\"Yes\")\n", "passed": true, "time": 0.14, "memory": 14200.0, "status": "done"}, {"code": "h, w = list(map(int, input().split()))\ns = ['.' + input() + '.' for _ in range(h)]\ns = ['.' * (w + 2)] + s + ['.' * (w + 2)]\n\nfor y in range(1, h + 1):\n    for x in range(1, w + 1):\n        if s[y][x] == '.':\n            continue\n        ok = False\n        for dy, dx in [(1, 0), (0, 1), (-1, 0), (0, -1)]:\n            if s[y + dy][x + dx] == '#':\n                ok = True\n        if not ok:\n            print('No')\n            return\nprint('Yes')\n", "passed": true, "time": 0.14, "memory": 14220.0, "status": "done"}, {"code": "import sys\n\n\ndef LI():\n    return list(map(int, input().split()))\n\n\ndef LSH(h):\n    return [input() for _ in range(h)]\n\n\nH, W = LI()\nmasu = LSH(H)\nfor i in range(H):\n    for j in range(W):\n        ok = 0\n        if masu[i][j] == \".\":\n            continue\n        if j+1 < W:\n            if masu[i][j+1] == \"#\":\n                ok = 1\n        if j-1 >= 0:\n            if masu[i][j-1] == \"#\":\n                ok = 1\n        if i+1 < H:\n            if masu[i+1][j] == \"#\":\n                ok = 1\n        if i-1 >= 0:\n            if masu[i-1][j] == \"#\":\n                ok = 1\n        if ok == 0:\n            print(\"No\")\n            return\nprint(\"Yes\")\n", "passed": true, "time": 0.14, "memory": 14128.0, "status": "done"}, {"code": "H, W = list(map(int, input().split()))\n\nS = [list(input()) for _ in range(H)]\n\nfor h in range(H):\n    for w in range(W):\n        if S[h][w] == \".\":\n            continue\n        \n        if h != 0 and S[h-1][w] == \"#\":\n            continue\n        elif h != H-1 and S[h+1][w] == \"#\":\n            continue\n        elif w != 0 and S[h][w-1] == \"#\":\n            continue\n        elif w != W-1 and S[h][w+1] == \"#\":\n            continue\n        \n        print(\"No\")\n        return\n\nprint(\"Yes\")\n\n", "passed": true, "time": 0.15, "memory": 14160.0, "status": "done"}, {"code": "h, w = list(map(int, input().split()))\n\nans = 'Yes'\n\ns = []\nfor i in range(h):\n    s += input().split()\n\n# 1\u6587\u5b57\u305a\u3064\u30ea\u30b9\u30c8\u306b\u3059\u308b\ns = list(map(list, s))\n\nfor i in range(h):\n    for j in range(w):\n        if s[i][j] == '#':\n            # \u4e0a\u4e0b\u5de6\u53f3\u3092\u30c1\u30a7\u30c3\u30af\n            # \u4ef2\u9593\u304c\u3044\u308b\u6642False\u3001\u5b64\u7acb\u3057\u3066\u3044\u308b\u3068\u304dTrue\n            if i > 0:\n                flg_up = False if s[i-1][j] == '#' else True\n            else:\n                flg_up = True\n            if i < h - 1:\n                flg_down = False if s[i+1][j] == '#' else True\n            else:\n                flg_down = True\n            if j > 0:\n                flg_left = False if s[i][j-1] == '#' else True\n            else:\n                flg_left = True\n            if j < w - 1:\n                flg_right = False if s[i][j+1] == '#' else True\n            else:\n                flg_right = True\n            # 1\u3064\u3067\u3082\u5b64\u7acb\u3067\u306a\u3044\u30d5\u30e9\u30b0\u304c\u3042\u308c\u3070\u5b64\u7acb\u3067\u306a\u3044\u306e\u3067False\u3001\u5168\u90e8\u5b64\u7acb\u306e\u6642True\n            if flg_up & flg_down & flg_left & flg_right:\n                ans = 'No'\n                break\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14324.0, "status": "done"}, {"code": "col,row = [int(x) for x in input().split()]\nmap_list = [[0] * (row+2)]\nfor i in range(col):\n    map_list.append([\"0\"] + list(input()) + [\"0\"])\nmap_list.append(map_list[0])\n#print(map_list)\n\ndef check(x,y):\n    lands = [[x,y]]\n    #print(lands)\n    area = 0\n    sealine = 0\n    while lands:\n        #print(area)\n        #print(lands)\n        x,y = lands.pop()\n        #print(x,y)\n        area += 1\n        map_list[y][x] = \"2\"\n        if map_list[y+1][x] == \"#\":\n            lands.append([x,y+1])\n        elif not map_list[y+1][x] == \"2\":\n            sealine += 1\n        if map_list[y][x+1] == \"#\":\n            lands.append([x+1,y])\n        elif not map_list[y][x+1] == \"2\":\n            sealine += 1\n        if map_list[y-1][x] == \"#\":\n            lands.append([x,y-1])\n        elif not map_list[y-1][x] == \"2\":\n            sealine += 1\n        if map_list[y][x-1] == \"#\":\n            lands.append([x-1,y])\n        elif not map_list[y][x-1] == \"2\":\n            sealine += 1\n        lands = list(map(tuple,lands))\n        lands = list(set(lands))\n        #print(lands)\n    return area\n\nres = \"Yes\"\nfor i in range(1,col+1):\n    for j in range(1,row+1):\n        if map_list[i][j] == \"#\":\n            if check(j,i) == 1:\n              res = \"No\"\nprint(res)", "passed": true, "time": 0.14, "memory": 14392.0, "status": "done"}, {"code": "h,w=map(int,input().split())\na=[input()+'.' for i in range(h)]+['.'*w]\nfor i in range(h):\n    for j in range(w):\n        if a[i][j]==\"#\":\n            if any([a[i+1][j]==a[i][j+1]==a[i-1][j]==a[i][j-1]==\".\"]):\n                print('No')\n                break\n    else:\n        continue\n    break\nelse:\n    print('Yes')", "passed": true, "time": 0.23, "memory": 14268.0, "status": "done"}, {"code": "def mapt(fn, *args):\n    return tuple(map(fn, *args))\n\n\ndef Input():\n    return mapt(int, input().split(\" \"))\n\n\ndef check(i, j, data):\n    return any(data[x][y] == \"#\"\n    for x, y in ((i-1, j), (i+1, j), (i, j-1), (i, j+1)))\n\n\ndef main():\n    h, w = Input()\n    a = [\"-\" * (w + 2)]\n    data = a + [\"-\" + input() + \"-\" for _ in range(h)] + a\n    ans = True\n    for i in range(1, h+1):\n        for j in range(1, w+1):\n            if data[i][j] == \"#\":\n                if not check(i, j, data):\n                    ans = False\n    if ans:\n        print(\"Yes\")\n    else:\n        print(\"No\")\n\n\nmain()", "passed": true, "time": 0.14, "memory": 14196.0, "status": "done"}, {"code": "H, W = map(int, input().split())\nx = [list(map(str, list(input()))) for l in range(H)]\n\nfor i in range(len(x)):\n    x[i].insert(0, \".\")\n    x[i].append(\".\")\nx.insert(0, [\".\"]*(W+2))\nx.append([\".\"]*(W+2))\n\nfor i in range(1, H+1):\n    for j in range(1, W+1):\n        if x[i][j] == \"#\":\n            if x[i][j-1] == x[i][j+1] == x[i-1][j] == x[i+1][j] == \".\":\n                print(\"No\")\n                return\nprint(\"Yes\")", "passed": true, "time": 0.18, "memory": 14080.0, "status": "done"}, {"code": "h, w = list(map(int, input().split()))\n\nans = 'Yes'\n\ns = []\nfor i in range(h):\n    s += input().split()\n\n# \u7aef\u306e\u51e6\u7406\u3092\u697d\u306b\u3059\u308b\u305f\u3081\u306b\u5468\u308a\u3092 . \u3067\u57cb\u3081\u308b\n#   ..........\n#   .#.#.#.#..\n#   ..##.###..\n#   .....##.#.\n#   ...##...#.\n#   ..####..#.\n#   ..........\n\n## \u4e0a\u7aef\ns.insert(0, ''.join(['.'] * (w + 2)))\n## \u4e21\u7aef\ns = list(map(lambda x: '.' + x + '.', s))\n## \u4e0b\u7aef\ns.insert(len(s), ''.join(['.'] * (w + 2)))\n\n# 1\u6587\u5b57\u305a\u3064\u30ea\u30b9\u30c8\u306b\u3059\u308b\ns = list(map(list, s))\n\n# 50 * 50\nfor i in range(1, h + 1):\n    for j in range(1, w + 1):\n        if (s[i][j] == '#') & (s[i-1][j] == '.') & (s[i+1][j] == '.') & (s[i][j-1] == '.') & (s[i][j+1] == '.'):\n            ans = 'No'\n            break\n    else:\n        continue\n    break\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14124.0, "status": "done"}, {"code": "H,W = list(map(int,input().split()))\n\nS = [\".\" * (W + 2)]\nS += [\".\" + input() + \".\" for i in range(H)]\nS += [\".\" * (W + 2)]\n\nfor i in range(1, H + 1):\n  for j in range(1, W + 1):\n    if S[i][j] != \"#\":\n      continue\n    for y,x in ((0,1),(0,-1),(1,0),(-1,0)):\n      if S[i + y][j + x] == \"#\":\n        break\n    else:\n      print(\"No\")\n      return\nprint(\"Yes\")\n", "passed": true, "time": 0.14, "memory": 14144.0, "status": "done"}, {"code": "h,w = map(int, input().split())\ns = []\n\nfor i in range(h):\n    li = input()\n    s.append(li)\n\n\n# \"#\" -> black\n# \".\" -> white\n\ndef check(s, x, y, w, h):\n    dx = [0,0,-1,1]\n    dy = [1,-1,0,0]\n\n    for i in range(4):\n        ny, nx = y+dy[i], x+dx[i]\n        if 0<=nx<w and 0<=ny<h:\n            if s[ny][nx]==\"#\":\n                return True\n    return False\n\nok = True\nfor i in range(h):\n    for j in range(w):\n        if s[i][j]==\"#\":\n            ok = check(s, j, i, w, h)\n            if not ok:\n                break\n    if not ok:\n        break\nif ok or (w==1 and h==1):\n    print(\"Yes\")\nelse:\n    print(\"No\")", "passed": true, "time": 0.14, "memory": 14148.0, "status": "done"}, {"code": "# -*- coding: utf-8 -*-\n\ndef check(H, W, s, x, y):\n    res = False\n    if x - 1 >= 0 and s[y][x-1] == '#':\n        res = True\n    if x + 1 < W and s[y][x+1] == '#':\n        res = True\n    if y - 1 >= 0 and s[y-1][x] == '#':\n        res = True\n    if y + 1 < H and s[y+1][x] == '#':\n        res = True\n\n    return res\n\n\nH,W = map(int, input().split())\ns = []\nfor h in range(H):\n    s.append(list(input()))\n\nfor y in range(H):\n    for x in range(W):\n        if s[y][x] == \"#\" and not check(H, W, s, x, y):\n            print(\"No\")\n            return\n\nprint(\"Yes\")", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "H,W = map(int,input().split())\n\nS = [\".\" * (W + 2)]\nS += [\".\" + input() + \".\" for i in range(H)]\nS += [\".\" * (W + 2)]\n\ndef solve():\n  for i in range(1, H + 1):\n    for j in range(1, W + 1):\n      if S[i][j] != \"#\":\n        continue\n      for y,x in ((0,1),(0,-1),(1,0),(-1,0)):\n        if S[i + y][j + x] == \"#\":\n          break\n      else:\n        return \"No\"\n  return \"Yes\"\n\nprint(solve())", "passed": true, "time": 0.14, "memory": 14124.0, "status": "done"}, {"code": "H,W = list(map(int,input().split()))\n\nS = [\".\" * (W + 2)]\nS += [\".\" + input() + \".\" for i in range(H)]\nS += [\".\" * (W + 2)]\n\nng = False\nfor i in range(1, H + 1):\n  for j in range(1, W + 1):\n    if S[i][j] != \"#\":\n      continue\n    for y,x in ((0,1),(0,-1),(1,0),(-1,0)):\n      if S[i + y][j + x] == \"#\":\n        break\n    else:\n      ng = True\nprint((\"YNeos\"[ng::2]))\n", "passed": true, "time": 0.24, "memory": 14268.0, "status": "done"}, {"code": "h, w = map(int, input().split())\nc = tuple(tuple(0 if i == \".\" else 1 for i in input()) for _ in range(h))\n \nfor i in range(h):\n    for j in range(w):\n        if c[i][j]:\n            T = c[i-1][j] if 0 <= i - 1 else 0\n            B = c[i+1][j] if i + 1 < h else 0\n            L = c[i][j-1] if 0 <= j - 1 else 0\n            R = c[i][j+1] if j + 1 < w else 0\n \n            if not (T or B or L or R):\n                print(\"No\")\n                break\n    else:\n        continue\n    break\nelse:\n    print(\"Yes\")", "passed": true, "time": 0.14, "memory": 14144.0, "status": "done"}, {"code": "h,w=list(map(int,input().split()))\n\nsquare=[]\nfor _ in range(h):\n    square.append(input())\n\ndef check(i,j):\n    flg = False\n    for di,dj in [[-1,0],[1,0],[0,-1],[0,1]]:\n        if di+i<0 or dj+j<0:\n            continue\n        if di+i>=h or dj+j>=w:\n            continue\n        if square[di+i][dj+j]==\"#\":\n            flg=True\n    return flg\n\nfor i in range(h):\n    for j in range(w):\n        if square[i][j]==\"#\":\n            if not check(i,j):\n                # print(i,j)\n                print('No')\n                return\n\nprint('Yes')\n\n", "passed": true, "time": 0.23, "memory": 14296.0, "status": "done"}, {"code": "H, W = [int(i) for i in input().split()]\nSS = [input() for _ in range(H)]\n\ndef get(lst, i, default=None):\n  try:\n    return lst[i]\n  except IndexError:\n    return default\n\nfor i in range(H):\n  for j in range(W):\n    s = SS[i][j]\n    if s == '#':\n      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)]:\n        print('No')\n        import sys\n        return\n\nprint('Yes')\n", "passed": true, "time": 0.14, "memory": 14324.0, "status": "done"}, {"code": "h, w = map(int, input().split())\nc = [input() for _ in range(h)]\n\nfor i in range(h):\n    for j in range(w):\n        if c[i][j] == \"#\":\n            upper = c[i-1][j] == \"#\" if 0 <= i - 1 else False\n            lower = c[i+1][j] == \"#\" if i + 1 < h else False\n            left = c[i][j-1] == \"#\" if 0 <= j - 1 else False\n            right = c[i][j+1] == \"#\" if j + 1 < w else False\n            \n            if not (upper or lower or left or right):\n                print(\"No\")\n                break\n    else:\n        continue\n    break\nelse:\n    print(\"Yes\")", "passed": true, "time": 0.24, "memory": 14228.0, "status": "done"}, {"code": "h,w=map(int,input().split())\nlis=[list(input()) for i in range(h)]\n\nans=[[0]*w for i in range(h)]\n\nfor i in range(h):\n  for j in range(w):\n    x,y=0,0\n    if lis[i][j]==\"#\":\n      ans[i][j]=1\n      for a in range(-1,2):\n        if 0<=i+a<h and lis[i+a][j]==\"#\" and a!=0:\n          x+=1\n      ans[i][j]+=x\n      for b in range(-1,2):\n        if 0<=j+b<w and lis[i][j+b]==\"#\" and b!=0:\n          y+=1\n      ans[i][j]+=y\n      if ans[i][j]==1:\n        print(\"No\")\n        return\n    else:\n      ans[i][j]=0\n      \nprint(\"Yes\")", "passed": true, "time": 0.24, "memory": 14356.0, "status": "done"}, {"code": "h,w=map(int,input().split())\na=['.'*(w+2)]\ns=['.'+input()+'.' for _ in range(h)]\ns=a+s+a\nf=True\nfor i in range(1,h+1):\n  for j in range(1,w+1):\n    if s[i][j]=='#' and s[i][j-1]=='.' and s[i][j+1]=='.' and s[i-1][j]=='.' and s[i+1][j]=='.':\n      f=False\nif f:\n  print('Yes')\nelse:\n  print('No')", "passed": true, "time": 0.23, "memory": 14224.0, "status": "done"}, {"code": "H,W = map(int,input().split())\ns = [input() for _ in range(H)]\nfor i in range(1,H-1):\n    for j in range(1,W-1):\n        if s[i][j] == \"#\":\n            if s[i][j-1] == \".\" and s[i][j+1] == \".\" and s[i-1][j] == \".\" and s[i+1][j] == \".\":\n                print(\"No\")\n                return\nprint(\"Yes\")", "passed": true, "time": 0.14, "memory": 14132.0, "status": "done"}, {"code": "H,W = map(int,input().split())\n\ncanvas = []\n\nfor i in range(H):\n  canvas.append(list(input()))\n  \n#print(canvas)\nfor i in range(H):\n  for j in range(W):\n    cnt = 0\n    if canvas[i][j] == \"#\":\n      for h in range(-1,2):\n        for w in range(-1,2):\n          if canvas[min(max(i+h,0),H-1)][min(max(j+w,0),W-1)]==\"#\" and (abs(h)+abs(w))%2==1:\n            cnt+=1\n      if cnt==0:\n        print(\"No\")\n        return\nprint(\"Yes\")", "passed": true, "time": 0.14, "memory": 14344.0, "status": "done"}, {"code": "h, w = map(int, input().split())\nc = [input() for _ in range(h)]\n\nfor i in range(h):\n    for j in range(w):\n        if c[i][j] == \"#\":\n            upper = c[i-1][j] == \"#\" if 0 <= i - 1 else False\n            lower = c[i+1][j] == \"#\" if i + 1 < h else False\n            left = c[i][j-1] == \"#\" if 0 <= j - 1 else False\n            right = c[i][j+1] == \"#\" if j + 1 < w else False\n            \n            if not (upper or lower or left or right):\n                print(\"No\")\n                break\n    else:\n        continue\n    break\nelse:\n    print(\"Yes\")", "passed": true, "time": 0.14, "memory": 14100.0, "status": "done"}, {"code": "h, w = list(map(int, input().split()))\n\nans = 'Yes'\n\ns = []\nfor i in range(h):\n    s += input().split()\n\n# \u7aef\u306e\u51e6\u7406\u3092\u697d\u306b\u3059\u308b\u305f\u3081\u306b\u5468\u308a\u3092 . \u3067\u57cb\u3081\u308b\n#   ..........\n#   .#.#.#.#..\n#   ..##.###..\n#   .....##.#.\n#   ...##...#.\n#   ..####..#.\n#   ..........\n\n## \u4e0a\u7aef\ns.insert(0, ''.join(['.'] * (w + 2)))\n## \u4e21\u7aef\ns = list(map(lambda x: '.' + x + '.', s))\n## \u4e0b\u7aef\ns.insert(len(s), ''.join(['.'] * (w + 2)))\n\n# 1\u6587\u5b57\u305a\u3064\u30ea\u30b9\u30c8\u306b\u3059\u308b\ns = list(map(list, s))\n\n# 50 * 50\nfor i in range(1, h + 1):\n    for j in range(1, w + 1):\n        if s[i][j] == '#':\n            # \u4e0a\u4e0b\u5de6\u53f3\u3092\u30c1\u30a7\u30c3\u30af\n            # \u4ef2\u9593\u304c\u3044\u308b\u6642False\u3001\u5b64\u7acb\u3057\u3066\u3044\u308b\u3068\u304dTrue\n            flg_up = False if s[i-1][j] == '#' else True\n            flg_down = False if s[i+1][j] == '#' else True\n            flg_left = False if s[i][j-1] == '#' else True\n            flg_right = False if s[i][j+1] == '#' else True\n            \n            # 1\u3064\u3067\u3082\u5b64\u7acb\u3067\u306a\u3044\u30d5\u30e9\u30b0\u304c\u3042\u308c\u3070\u5b64\u7acb\u3067\u306a\u3044\u306e\u3067False\u3001\u5168\u90e8\u5b64\u7acb\u306e\u6642True\n            if flg_up & flg_down & flg_left & flg_right:\n                ans = 'No'\n                break\n    else:\n        continue\n    break\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14116.0, "status": "done"}, {"code": "import re\nimport copy\n\ndef accept_input():\n    H, W = list(map(int, input().split()))\n    S = []\n    for _ in range(H):\n        S.append(input())\n    return H,W,S\n\ndef process(s):\n    if s == \"#\":\n        return 1\n    else:\n        return 0\nH,W,S = accept_input()\narr1 = [(-1,-1),(-1,0),(-1,1),(1,-1),(1,0),(1,1),(0,1),(0,-1)]\narr = [(-1,0),(1,0),(0,1),(0,-1)]\nnew_S = copy.deepcopy(S)\ng = 0\nb = 0\nfor i in range(H):\n    for j in range(W):\n        if new_S[i][j] == \"#\":\n            bl = 0\n            for idou in arr:\n                if i+idou[0] == -1 or i+idou[0] == H:\n                    continue\n                elif j+idou[1] == -1 or j+idou[1] == W:\n                    continue\n                else:\n                    if new_S[i+idou[0]][j+idou[1]] == \"#\":\n                        bl = 1\n            if bl != 1:\n                b = 1\n                break\n    if b == 1:\n        break\nif b == 1:\n    print(\"No\")\nelse:\n    print(\"Yes\")\n", "passed": true, "time": 0.15, "memory": 14204.0, "status": "done"}, {"code": "H, W = map(lambda x:int(x)+2, input().split())\ngrid = \".\"*W\nfor _ in range(H-2):\n  grid += \".\"+input()+\".\"\ngrid += \".\"*W\n\nFlag = True\nmove_list = [1, -1, W, -W]\n\nfor i in range(1, H-1):\n  for j in range(1, W-1):\n    if grid[i*W+j] == \"#\" and all(grid[i*W+j+move] == \".\" for move in move_list):\n      Flag = False\n      break\n\nif Flag:\n  print(\"Yes\")\nelse:\n  print(\"No\")", "passed": true, "time": 0.14, "memory": 14112.0, "status": "done"}]