#include using namespace std; #define inRange(x, a, b) a <= x && x < b int main(){ int h, w; cin >> h >> w; char mat[50][50]; bool judge = true; for(int i = 0; i < h; i++){ for(int j = 0; j < w; j++){ cin >> mat[i][j]; if(mat[i][j] == '#') judge = false; } } if(judge){ cout << "NO" << endl; return 0; } for(int di = 0; !judge && di < h; di++){ for(int dj = -w+1; !judge && dj < w; dj++){ if(di == 0 && dj == 0) continue; int check[51][51] = {}; bool inner = true; for(int i = 0; inner && i < h; i++){ for(int j = 0; inner && j < w; j++){ if(mat[i][j] == '#' && check[i][j] == 0){ int ni = i + di; int nj = j + dj; if(inRange(ni, 0, h) && inRange(nj, 0, w) && mat[ni][nj] == '#' && check[ni][nj] == 0){ check[i][j] = 1; check[ni][nj] = 2; }else{ inner = false; } } } } if(inner) judge = true; } } if(judge) cout << "YES" << endl; else cout << "NO" << endl; return 0; }