#include using namespace std; const string yes = "YES"; const string no = "NO"; const int MAX = 55; int h, w; char S[MAX][MAX]; bool vis[MAX][MAX]; inline bool in(const int hh, const int ww) { return 0 <= hh && hh < h && 0 <= ww && ww < w; } int main() { scanf("%d%d", &h, &w); { bool valid = false; for (int i = 0; i < h; i++) { scanf("%s", S[i]); for (int j = 0; j < w; j++) { valid |= S[i][j] == '#'; } } if (!valid) { cout << no << endl; return 0; } } for (int i = -h; i <= h; i++) { for (int j = -w; j <= w; j++) { if (i == 0 && j == 0) { continue; } bool ok = true; memset(vis, false, sizeof(vis)); for (int k = 0; k < h; k++) { for (int l = 0; l < w; l++) { if (S[k][l] == '#' && !vis[k][l]) { if (!in(k + i, l + j) || S[k + i][l + j] == '.' || vis[k + i][l + j]) { ok = false; } else { vis[k + i][l + j] = true; } } } } if (ok) { //cerr << i << " " << j << endl; cout << yes << endl; return 0; } } } cout << no << endl; return 0; }