#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace atcoder; using Graph = vector>; using ll = long long; typedef pair P_ll; typedef pair P; const ll INF_ll = 1e17; const int INF = 1e8; template bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; } template bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; } template using min_priority_queue = priority_queue, greater>; int main() { int H, W; cin >> H >> W; vector S(H); for (int i = 0; i < H; i++) { cin >> S[i]; } for (int di = -(H - 1); di <= H - 1; di++) { for (int dj = -(W - 1); dj <= W - 1; dj++) { if (di == 0 && dj == 0) { continue; } vector> X(H, vector(W, -1)); int cnt = 0; bool ok = true; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { if (S[i][j] == '.') { continue; } if (X[i][j] == 1) { continue; } X[i][j] = 0; if (i + di >= H || i + di < 0 || j + dj >= W || j + dj < 0) { ok = false; continue; } if (S[i + di][j + dj] == '.') { ok = false; continue; } X[i + di][j + dj] = 1; } } if (ok) { // cout << di << "," << dj << endl; cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }