#include using namespace std; int main(int argc, const char *argv[]) { int h, w, blk_cnt; cin >> h >> w; vector grid(h); for (int i = 0; i < h; ++i) { cin >> grid[i]; for (auto c : grid[i]) { if (c == '#') { blk_cnt++; } } } if (blk_cnt == 0) { cout << "YES" << '\n'; return 0; } bool ans = false; for (int i = -h; i <= h && !ans; ++i) { for (int j = -w; j <= w && !ans; ++j) { if (i == 0 && j == 0) { continue; } bool ok = true; vector> used(h, vector(w, false)); for (int y = 0; y < h && ok; ++y) { for (int x = 0; x < w && ok; ++x) { char c = grid[y][x]; if (c != '#' || used[y][x]) { continue; } int x2 = x + j, y2 = y + i; if (x2 < 0 || x2 >= w || y2 < 0 || y2 >= h || grid[y2][x2] != '#' || used[y2][x2]) { ok = false; break; } used[y2][x2] = true; used[y][x] = true; } } if (ok) { ans = true; } } } cout << (ans ? "YES" : "NO") << '\n'; }