#include #include #include #include #include #include #include #include #include #include using namespace std; int main(){ int h, w; cin >> h >> w; vector s(h); for(int i=0; i> s[i]; } bool ok = false; for(int dy=0; dy> c(h, vector(w,-1)); int cnt = 0; for(int i=0; i= h || x < 0 || x >= w )){ if(s[y][x] == '.'){ break; } (color?red:blue) += 1; c[y][x] = color; color ^= 1; y += dy; x += dx; } x = j-dx, y = i-dy; color = 1; while(!( y < 0 || y >= h || x < 0 || x >= w )){ if(s[y][x] == '.'){ break; } (color?red:blue) += 1; c[y][x] = color; color ^= 1; y -= dy; x -= dx; } if(!(red>0 && blue>0 && red==blue)){ valid = false; break; }else{ cnt++; } } } if(valid){ cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }