#include using namespace std; int main(int argc, const char *argv[]) { int h, w; cin >> h >> w; vector grid(h); for (int i = 0; i < h; ++i) { cin >> grid[i]; } bool ans = false; for (int i = 0; i <= h && !ans; ++i) { for (int j = 0; j < w && !ans; ++j) { if (i + 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 >= w || 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'; }