#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define ll long long #define INF (1 << 30) #define INFLL (1LL << 60) #define FOR(i,a,b) for(ll i = (a);i<(b);i++) #define REP(i,a) FOR(i,0,(a)) #define MP make_pair int h, w, how = 0; bool hyo[51][51] = {}; bool solve(int plusx, int plusy){ int now = 0; bool used[51][51] = {}; for(int y = 0;y < h;y++){ for(int x = 0;x < w;x++){ if(hyo[x][y] && !used[x][y]){ int tox = x + plusx, toy = y + plusy; if(tox >= w || toy >= h) return false; if(!hyo[tox][toy]) return false; used[x][y] = true; used[tox][toy] = true; now += 2; } } } if(now == how) return true; return false; } int main() { cin >> h >> w; string str; for(int i = 0;i < h;i++){ cin >> str; for(int j = 0;j < w;j++){ if(str[j] == '#'){ hyo[j][i] = true; how++; } } } bool ans = false; for(int i = 0;i < w;i++){ for(int j = 0;j < h;j++){ if(solve(i, j)) ans = true; } } if(ans) cout << "YES" << endl; else cout << "NO" << endl; return 0; }