#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using P = pair; constexpr int INF = 1001001001; constexpr int mod = 1000000007; // constexpr int mod = 998244353; template inline bool chmax(T& x, T y){ if(x < y){ x = y; return true; } return false; } template inline bool chmin(T& x, T y){ if(x > y){ x = y; return true; } return false; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int h, w; cin >> h >> w; vector s(h); for(int i = 0; i < h; ++i) cin >> s[i]; for(int dx = -h; dx <= h; ++dx){ for(int dy = -w; dy <= w; ++dy){ if(dx == 0 && dy == 0) continue; vector> used(h, vector(w)); for(int x = 0; x < h; ++x){ for(int y = 0; y < w; ++y){ if(used[x][y] || s[x][y] == '.') continue; int nx = x + dx, ny = y + dy; if(nx < 0 || nx >= h || ny < 0 || ny >= w || used[nx][ny] || s[nx][ny] == '.') continue; used[x][y] = used[nx][ny] = true; } } bool ok = true; for(int x = 0; x < h; ++x){ for(int y = 0; y < w; ++y){ if(s[x][y] == '#' && !used[x][y]) ok = false; } } if(ok){ cout << "YES\n"; return 0; } } } cout << "NO\n"; return 0; }