#include #include #include using namespace atcoder; using mint = modint1000000007; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 100000000000000000 vector get(int h,int w,int hh,int ww){ //cout< ret(h,string(w,'.')); rep(i,h){ rep(j,w){ if(i!=0&&i!=h-1&&j!=0&&j!=w-1)ret[i][j] = '#'; } } rep(i,hh){ rep(j,ww){ ret[i][j] = '#'; ret[i+1][j] = '.'; ret[i+1][j+1] = '.'; ret[i][j+1] = '.'; } } return ret; } bool check(vector S){ rep(i,S.size()){ rep(j,S[0].size()){ auto r = get(S.size(),S[0].size(),i,j); if(r==S)return true; } } //cout<<'a'<>N>>M; vector S(N); rep(i,N)cin>>S[i]; while(S.back() == string(M,'#'))S.pop_back(); while(S[0] == string(M,'#'))S.erase(S.begin()); while(true){ bool f = true; rep(i,S.size()){ if(S[i].back()!='#')f = false; } if(!f)break; rep(i,S.size())S[i].pop_back(); } while(true){ bool f = true; rep(i,S.size()){ if(S[i][0]!='#')f = false; } if(!f)break; rep(i,S.size())S[i].erase(S[i].begin()); } rep(i,4){ //rep(j,S.size())cout< temp(S[0].size(),""); rep(j,S.size()){ rep(k,S[j].size()){ temp[k] += S[S.size()-1-j][k]; } } swap(S,temp); } cout<<"NO"<