#include #include #include #include #include #include #define Max(a, b) ((a) > (b) ? (a) : (b)) #define Min(a, b) ((a) > (b) ? (b) : (a)) #define abs(x) ((x) > 0 ? (x) : -(x)) #define rep(i, n) for(int i = 0; i < (n); i++) #define INF 1000000000000 //10^12 #define MOD 1000000007 //10^9 + 7 #define endl printf("\n") typedef long long ll; int main(int argc, char **argv) { int h, w; scanf("%d %d", &h, &w); char s[50][51]; for (int i = 0; i < h; i++) { scanf("%s", s[i]); } int b = 0; for(int i = 0; i < h; i++) { for(int j = 0; j < w; j++) { if (s[i][j] == '#') b++; } } if (b == 0 || (b & 1) == 1) { printf("NO\n"); return 0; } int cnt; for (int y = -h + 1; y < h; y++) { for (int x = -w + 1; x < w; x++) { int v[50][50] = {}; cnt = 0; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { if(v[i][j] != 1 && s[i][j] == '#' && i + y < h && j + x < w && i + y >= 0 && j + x >= 0 && v[i + y][j + x] != 1 && s[i + y][j + x] == '#') { v[i][j]++; v[i + y][j + x]++; cnt += 2; } } } if(b == cnt){ //printf("%d %d\n", x, y); printf("YES\n"); return 0; } } } printf("NO\n"); return 0; }