#include using namespace std; using ll = long long; template istream& operator >> (istream& is, vector& vec) { for(T& x : vec) is >> x; return is; } template ostream& operator << (ostream& os, const vector& vec) { if(vec.empty()) return os; os << vec[0]; for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it; return os; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int h, w; cin >> h >> w; vector A(h); cin >> A; vector dp(h, vector(w, vector(4, -1))); vector dp2(h, vector(w)), dp3(h, vector(w)); auto rec = [&](auto rec, int y, int x, int ds) -> int { if(y < 0 || x < 0 || y >= h || x >= w) return 0; if(dp[y][x][ds] != -1) return dp[y][x][ds]; if(A[y][x] == '.') return dp[y][x][ds] = 0; return dp[y][x][ds] = 1 + rec(rec, y + (ds & 1 ? 1 : -1), x + (ds & 2 ? 1 : -1), ds); }; for(int y = 0; y < h; y++){ for(int x = 0; x < w; x++){ if(A[y][x] == '.') continue; int ans = 1 << 30; for(int s = 0; s < 4; s++){ ans = min(ans, rec(rec, y, x, s)); } if(ans >= 2) dp2[y][x] = dp3[y][x] = ans; } } for(int y = 0; y + 1 < h; y++){ for(int x = 0; x < w; x++){ if(x + 1 < w) dp2[y + 1][x + 1] = max(dp2[y + 1][x + 1], dp2[y][x] - 1); if(x >= 1) dp2[y + 1][x - 1] = max(dp2[y + 1][x - 1], dp2[y][x] - 1); } } for(int y = h - 1; y >= 1; y--){ for(int x = 0; x < w; x++){ if(x + 1 < w) dp3[y - 1][x + 1] = max(dp3[y - 1][x + 1], dp3[y][x] - 1); if(x >= 1) dp3[y - 1][x - 1] = max(dp3[y - 1][x - 1], dp3[y][x] - 1); } } for(int y = 0; y < h; y++){ for(int x = 0; x < w; x++){ if(A[y][x] == '.') continue; if(dp2[y][x] + dp3[y][x] == 0){ cout << "No\n"; return 0; } } } cout << "Yes\n"; }