#define _CRT_SECURE_NO_WARNINGS //#define _GLIBCXX_DEBUG #include using namespace std; typedef long long ll; //#define int ll //#define endl "\n" typedef vector vi; typedef vector vvi; typedef pair pii; #define all(c) (c).begin(), (c).end() #define loop(i,a,b) for(ll i=a; i ostream & operator<<(ostream & os, vector const &); template typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple const &){} template typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple const & t){ os << (n==0?"":" ") << get(t); _ot(os, t); } template ostream & operator<<(ostream & os, tuple const & t){ _ot<0>(os, t); return os; } template ostream & operator<<(ostream & os, pair const & p){ return os << "(" << p.first << ", " << p.second << ") "; } template ostream & operator<<(ostream & os, vector const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; } template inline bool chmax(T & x, T const & y){ return x inline bool chmin(T & x, T const & y){ return x>y ? x=y,true : false; } #ifdef DEBUG #define dump(...) (cerr<<#__VA_ARGS__<<" = "<= h || x+dx >= w || x+dx < 0 || y+dy < 0) continue; if(used[y][x] || used[y+dy][x+dx]) continue; if(g[y][x] == '#' && g[y+dy][x+dx] == '#'){ used[y+dy][x+dx] = used[y][x] = true; cnt += 2; } } return cnt == c && cnt; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); while(cin >> h >> w){ c = 0; rep(i,h){ cin >> g[i]; rep(j,w) if(g[i][j]=='#') c++; } bool ok = false; for(int dy=-h-10; dy<=h+10 && !ok; dy++){ for(int dx=-w-10; dx<=w+10 && !ok; dx++){ if(dx==0 && dy==0) continue; if(check(dx,dy)){ ok = true; } } } puts(ok ? "YES" : "NO"); } }