#include using namespace std; using ll = long long; template istream& operator >> (istream& is, vector& vec) { for(T& x : vec) is >> x; return is; } 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 Sp, Sm; auto rec = [&](auto rec, int y, int x, int ds) -> int { if(y < 0 || x < 0 || y >= h || x >= w) return 1; 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] = 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; bool flg = true; for(int s = 0; s < 4; s++){ if(rec(rec, y, x, s) == 0){ flg = false; break; } } if(flg){ Sp.push_back(y + x); Sm.push_back(y - x); } } } sort(Sp.begin(), Sp.end()); Sp.erase(unique(Sp.begin(), Sp.end()), Sp.end()); sort(Sm.begin(), Sm.end()); Sm.erase(unique(Sm.begin(), Sm.end()), Sm.end()); for(int y = 0; y < h; y++){ for(int x = 0; x < w; x++){ if(A[y][x] == '.') continue; if(binary_search(Sp.begin(), Sp.end(), y + x) || binary_search(Sm.begin(), Sm.end(), y - x))continue; cout << "No\n"; return 0; } } cout << "Yes\n"; }