#include using namespace std; #define int long long #define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++) #define all(x) (x).begin(),(x).end() #define sz(x) ((int)x.size()) templatebool chmax(T &a,T b){if(abool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;} typedef pair pii; typedef vector vi; typedef vector vvi; const int inf = 1LL<<60; const int mod = 1e9 + 7; const double eps = 1e-9; /*{ }*/ signed main(){ int h, w; cin >> h >> w; vector s(h); int black = 0; rep(i, 0, h){ cin >> s[i]; rep(j, 0, w) if(s[i][j] == '#'){ black++; } } if(black%2){ cout << "NO" << endl; return false; } rep(dy, 0, h) rep(dx, 0, w){ if(!dy and !dx) continue; vvi c(h, vi(w)); if([&](){ rep(y, 0, h-dy) rep(x, 0, w-dx){ if(s[y][x] == '#' and !c[y][x]){ if(s[y+dy][x+dx] == '.' or c[y+dy][x+dx]){ return true; }else{ c[y][x] = 1; c[y+dy][x+dx] = 2; } } } return false; }()) continue; if([&](){ rep(y, 0, h) rep(x, 0, w){ if(s[y][x] == '#' and !c[y][x]){ return true; } } return false; }()) continue; cout << "YES" << endl; return 0; } cout << "NO" << endl; return 0; }