#include using namespace std; #define repl(i, l, r) for (ll i = (l); i < (r); i++) #define rep(i, n) repl(i, 0, n) #define CST(x) cout << fixed << setprecision(x) using ll = long long; constexpr ll MOD = 1000000007; constexpr int inf = 1e9 + 10; constexpr ll INF = (ll)4e18 + 10; constexpr int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0}; constexpr int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0}; template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); int h, w; cin >> h >> w; string a[h]; rep(i, h) cin >> a[i]; int cnt = 0; rep(i, h) rep(j, w) { if (a[i][j] == '#') cnt++; } rep(i, h) rep(j, w) { if (i + j == 0) continue; vector> c(h, vector(w)); rep(s, h) rep(t, w) { if (s + i >= h or t + j >= w or a[s][t] == '.' or c[s][t]) continue; if (a[s][t] == a[s + i][t + j]) { c[s][t] = c[s + i][t + j] = 1; } } int m = 0; rep(s, h) rep(t, w) m += c[s][t]; if (m == cnt) { cout << "YES" << endl; return 0; } } cout << "NO" << endl; return 0; }