#include #define rep(i, n) for (int (i) = 0; (i) < (int)(n); (i)++) using namespace std; typedef long long ll; const int MAXH = 64; string s[MAXH]; bool used[MAXH][MAXH]; int H, W; bool ok(int dx, int dy) { memset(used, 0, sizeof(used)); for (int y = 0; y < H; y++) { for (int x = 0; x < W; x++) { if (s[y][x] == '.' || used[y][x]) continue; used[y][x] = true; int ny = y+dy, nx = x+dx; if (ny < 0 || ny >= H || nx < 0 || nx >= W) return false; if (s[ny][nx] == '#' && !used[ny][nx]) { used[ny][nx] = true; } else { return false; } } } for (int y = 0; y < H; y++) for (int x = 0; x < W; x++) { if (s[y][x] == '#' && !used[y][x]) return false; } return true; } int main() { cin >> H >> W; int cnt = 0; for (int i = 0; i < H; i++) { cin >> s[i]; for (int j = 0; j < W; j++) if (s[i][j] == '#') cnt++; } if (cnt % 2 == 1 || cnt == 0) { cout << "NO" << endl; return 0; } for (int dx = -W; dx <= W; dx++) { for (int dy = -H; dy <= H; dy++) { if (ok(dx, dy)) { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }