#include using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < n; ++i) #define P pair #define Graph vector> #define fi first #define se second #define vvvvll vector>>> #define vvvll vector>> #define vvll vector> #define vll vector #define pqll priority_queue #define pqllg priority_queue, greater> constexpr ll INF = (1ll << 60); constexpr ll mod = 1000000007; // 998244353; constexpr double pi = 3.14159265358979323846; template inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } void pt_vvll(vvll v) { ll vs = v.size(), vs0 = v[0].size(); rep(i, vs) { rep(j, vs0) { cout << v[i][j]; if (j != vs0 - 1) cout << " "; else cout << "\n"; } } } void pt_vll(vll v) { ll vs = v.size(); rep(i, vs) { cout << v[i]; if (i == vs - 1) cout << "\n"; else cout << " "; } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll H, W; cin >> H >> W; vector s(H); rep(i, H) { cin >> s[i]; } ll cnt = 0; rep(i, H) rep(j, W) if (s[i][j] == '#') cnt++; if (cnt <= 2 || cnt % 2 == 1) { cout << "NO\n"; return 0; } rep(dy, H) { rep(dx, W) { if (dy == 0 && dx == 0) continue; vector> seen(H, vector(W)); bool can = true; rep(i, H) { rep(j, W) { if (seen[i][j]) continue; if (i + dy < H && j + dx < W && s[i][j] == '#' && s[i + dy][j + dx] == '#' && !seen[i + dy][j + dx]) { seen[i][j] = true; seen[i + dy][j + dx] = true; } } } rep(i, H) rep(j, W) { if (s[i][j] == '#' && !seen[i][j]) can = false; } if (can) { // cout << dy << " " << dx << "\n"; cout << "YES\n"; return 0; } } } cout << "NO\n"; return 0; }