#include using namespace std; using ll = long long; int H, W; vector S; bool inside(int x, int y){ return 0 <= x && x < H && 0 <= y && y < W; } int dx[4] = {1, 1, -1, -1}; int dy[4] = {1, -1, -1, 1}; int main(void){ ios::sync_with_stdio(false); cin.tie(nullptr); cin >> H >> W; S.resize(H); auto vtd = vector>(H, vector(W)); auto power = vector>>(H, vector>(W, vector(4, -1))); for(int i = 0;i < H;i++)cin >> S[i]; using pp = pair>; priority_queue que; for(int i = 0;i < H;i++){ for(int j = 0;j < W;j++){ if(S[i][j] == '.')continue; int l = 0, r = max(H, W) + 1; while(r - l > 1){ int m = (l + r) / 2; int c = 0; for(int d = 0;d < 4;d++){ int x = i + dx[d] * m, y = j + dy[d] * m; if(!inside(x, y))continue; if(S[x][y] == '#')c++; } if(c == 4)l = m; else r = m; } if(l > 0){ for(int d = 0;d < 4;d++){ power[i][j][d] = l; que.push({l, {i, j, d}}); } } } } while(que.size()){ auto [p, v] = que.top(); que.pop(); auto [x, y, d] = v; if(p < power[x][y][d])continue; int nx = x + dx[d], ny = y + dy[d]; if(!inside(nx, ny))continue; if(S[nx][ny] == '.')continue; if(power[nx][ny][d] < p - 1){ power[nx][ny][d] = p - 1; if(p - 1 > 0)que.push({p - 1, {nx, ny, d}}); } } bool f = true; for(int i = 0;i < H;i++){ for(int j = 0;j < W;j++){ if(S[i][j] != '#')continue; bool g = false; for(int d = 0;d < 4;d++){ if(power[i][j][d] != -1)g = true; } f &= g; } } cout << (f ? "Yes\n" : "No\n"); return 0; }