#include "bits/stdc++.h" using namespace std; bool check(){ int H, W; cin >> H >> W; vector> board(H, vector(W)); string s; int button = 0; for (int i = 0; i < H; i++) { cin >> s; for (int j = 0; j < W; j++) { if (s[j] == '#'){ board[i][j] = 1; button++; } } } if (button == 0) return false; vector> dp(H, vector(W)); int turn = 0; int dk = 0; int dy[] {1, 0, -1, 0}; int dx[] {0, 1, 0, -1}; for (int t = 1; t < 4; t += 2){ for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { if (!board[i][j]) continue; for (int k = 0; k < 4; k++) { dk = k; int count = 1; int y = i; int x = j; turn++; while (true){ int ny, nx; ny = y + dy[dk]; nx = x + dx[dk]; if (nx < 0 || ny < 0 || nx >= W || ny >= H || board[nx][nx] == 0 || dp[ny][nx] == turn){ dk += t; if (dk >= 4) dk -= 4; ny = y + dy[dk]; nx = x + dx[dk]; if (nx < 0 || ny < 0 || nx >= W || ny >= H || board[nx][nx] == 0 || dp[ny][nx] == turn) break; } y = ny; x = nx; dp[y][x] = turn; count++; } if (count == button) return true; } } } } return false; } int main(){ if (check()) cout << "YES" << endl; else cout << "NO" << endl; }