using System; using System.Collections.Generic; using System.Linq; class Magatro { static int H, W; static string[] S; static void Main() { Read(); for(int x = -W; x <= W; x++) { for(int y = 0; y <= H; y++) { if (x == 0 && y == 0) { continue; } if (s(x, y)) { Console.WriteLine("YES"); return; } } } Console.WriteLine("NO"); } static bool s(int x,int y) { int[,] ban = new int[H, W]; for(int i = 0; i < H; i++) { for(int j = 0; j < W; j++) { if (S[i][j] == '#') { if (ban[i, j] == 0) { ban[i, j] = 1; int bly = i + y; int blx = j + x; if (blx < W && blx >= 0 && bly < H && bly >= 0) { if (S[bly][blx] != '#') { return false; } ban[bly, blx] = 2; } else { return false; } } } } } bool a = false; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { if (S[i][j] == '#' ) { a = true; if( ban[i, j] == 0) return false; } } } return a; } static void Read() { string[] s = Console.ReadLine().Split(' '); H = int.Parse(s[0]); W = int.Parse(s[1]); S = new string[H]; for(int i = 0; i < H; i++) { S[i] = Console.ReadLine(); } } }