#include using namespace std; using ll = long long; using P = pair; int main() { int h, w; cin >> h >> w; string s[h]; int sum = 0; for (int i = 0; i < h; i++) { cin >> s[i]; for (int j = 0; j < w; j++) { if (s[i][j] == '#') sum++; } } for (int dy = 0; dy < h; dy++) { for (int dx = 0; dx < w; dx++) { if (dy == 0 && dx == 0) continue; int color[h][w] = {}; int cnt = 0; bool flag = true; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { if (s[i][j] != '#') continue; if (color[i][j] > 0) continue; int ny = i + dy, nx = j + dx; if (0 <= ny && ny < h && 0 <= nx && nx < w && color[ny][nx] == 0) { color[i][j] = 1; color[ny][nx] = 2; cnt += 2; } else { flag = false; break; } } if (!flag) break; } if (sum == cnt && flag) { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; }