#include #include #include #include #include #include #include #include #include using namespace std; #include using namespace atcoder; #define rep(i,n) for (int i = 0; i < (n); ++i) #define frep(i,a,b) for (int i = (a); i <= (b); ++i) #define all(x) (x).begin(),(x).end() #define bit(n,k) ((n>>k)&1) /*nのk bit目*/ #define debug(x) cout << #x << ": " << x << endl; typedef long long ll; using P = pair; using P2 = pair; using mint = modint1000000007; #define INF 1001001001 #define LINF (1LL<<60) #define F first #define S second template inline bool chmax(T& a, T b){ if(a inline bool chmin(T& a, T b){ if(a>b){ a=b; return 1; } return 0; } int main() { int h, w; cin >> h >> w; vector s(h); rep(i, h) cin >> s[i]; vector f; bool ans = false, ok; int a = 0; rep(i, h) rep(j, w) if (s[i][j] == '#') a++; if (a == 0) { puts("NO"); return 0; } for (int i = -h+1; i < h; i++) { for (int j = -w+1; j < w; j++) { if (i == 0 && j == 0) continue; f = s; ok = true; rep(k,h) { rep(l, w) { if (f[k][l] == '#') { if (k+i < 0 || h-1 < k+i || l+j < 0 || w-1 < l+j || f[k+i][l+j] != '#') { ok = false; break; } else { f[k+i][l+j] = '.'; } } } } if (ok) ans = true; } } if (ans) puts("YES"); else puts("NO"); }