#include<bits/stdc++.h> typedef uint64_t u64; typedef int64_t i64; using namespace std; void solve(); int main(){ cout<<fixed<<setprecision(15); bool is_multicase=false; int T=1; if(is_multicase){ cin>>T; } for(int i=0;i<T;++i){ solve(); } return 0; } template<typename T> void turtle_in(T& n){ cin>>n; } template<typename T,typename U> void turtle_in(pair<T,U>& p){ turtle_in(p.first); turtle_in(p.second); } template<typename T> void turtle_in(vector<T>& v){ for(auto& u:v){ turtle_in(u); } } template<typename T> void turtle_out(T& n){ cout<<n; } template<typename T,typename U> void turtle_out(pair<T,U>& p){ cout<<"{"; turtle_out(p.first); cout<<", "; turtle_out(p.second); cout<<"}"; } template<typename T> void turtle_out(vector<T>& v){ for(int i=0;i<int(v.size());++i){ turtle_out(v[i]); if(i!=v.size()-1){ cout<<" "; } } cout<<endl; } template<typename T> void turtle_out(vector<vector<T>>& v){ for(int i=0;i<int(v.size());++i){ turtle_out(v[i]); } } void scan(){} template<typename T,class... Args> void scan(T& n,Args&... args){ turtle_in(n); scan(args...); } void print(){} template<typename T,class... Args> void print(T n,Args... args){ turtle_out(n); print(args...); } template<typename T> void println(T n){ turtle_out(n); cout<<endl; } template<typename T,class... Args> void println(T n,Args... args){ turtle_out(n); cout<<" "; println(args...); } template<u64 mod> struct modint{ u64 val; modint(i64 val_=0):val((val_%i64(mod)+i64(mod))%i64(mod)){} modint operator-(){ return modint(mod-val); } modint operator+(modint rhs){ return modint(*this)+=rhs; } modint operator-(modint rhs){ return modint(*this)-=rhs; } modint operator*(modint rhs){ return modint(*this)*=rhs; } modint operator/(modint rhs){ return modint(*this)/=rhs; } modint &operator+=(modint rhs){ val+=rhs.val; val-=((val>=mod)?mod:0); return (*this); } modint &operator-=(modint rhs){ val+=((val<rhs.val)?mod:0); val-=rhs.val; return (*this); } modint &operator*=(modint rhs){ val=val*rhs.val%mod; return (*this); } modint &operator/=(modint rhs){ u64 ex=mod-2; modint now=1; while(ex){ now*=((ex&1)?rhs:1); rhs*=rhs,ex>>=1; } return (*this)*=now; } bool operator==(modint rhs){ return val==rhs.val; } bool operator!=(modint rhs){ return val!=rhs.val; } friend std::ostream &operator<<(std::ostream& os,modint x){ return os<<(x.val); } friend std::istream &operator>>(std::istream& is,modint& x){ u64 t; is>>t,x=t; return is; } }; template<typename T,typename U> T power(T a,U n){ T res=1; while(n>0){ if(n%2==1){ res*=a; } a*=a; n/=2; } return res; } template<typename T> struct genrand{ uniform_int_distribution<T> gen; mt19937 engine; genrand(T a,T b):gen(a,b){ random_device seed_gen; engine.seed(seed_gen()); } T operator()(){ return gen(engine); } }; template<typename T> struct comb{ vector<T> dat,idat; comb(int mx=3000000):dat(mx+1,1),idat(mx+1,1){ for(int i=1;i<=mx;++i){ dat[i]=dat[i-1]*i; } idat[mx]/=dat[mx]; for(int i=mx;i>0;--i){ idat[i-1]=idat[i]*i; } } T operator()(int n,int k){ if(n<0||k<0||n<k){ return 0; } return dat[n]*idat[k]*idat[n-k]; } }; void solve(){ int H,W; scan(H,W); vector<string> S(H); scan(S); set<pair<int,int>> all; for(int i=0;i<H;++i){ for(int j=0;j<W;++j){ if(S[i][j]=='#'){ all.insert({i,j}); } } } if(all.size()==0){ println("NO"); return; } for(int I=0;I<=H-1;++I){ for(int J=-W+1;J<=W-1;++J){ if(I==0 && J==0){ continue; } set<pair<int,int>> st=all; vector<vector<int>> tmp; while(st.size()){ auto p=(*st.begin()); st.erase(st.begin()); tmp.emplace_back(); tmp.back().emplace_back(0); for(int t=-50;t<=50;++t){ if(st.count({p.first+I*t,p.second+J*t})){ st.erase({p.first+I*t,p.second+J*t}); tmp.back().emplace_back(t); } } } bool f=1; for(auto v:tmp){ while(2<=v.size()){ int n=v.size(); if(v[n-2]+1==v[n-1]){ v.resize(n-2); } else{ break; } } if(v.size()!=0){ f=0; } } if(f){ println("YES"); return; } } } println("NO"); }