class LIST: __slots__ = ['li', 'len_li', 'b', 'ma', 'cnt'] def __init__(self, li): self.li = li self.len_li = len(li) self.b = [0] * self.len_li self.ma = {a:i for i, a in enumerate(li)} self.cnt = 0 def __len__(self): return self.b.count(0) def reset(self): self.b = [0] * self.len_li self.cnt = 0 def pop(self, a): self.b[a] = 1 return self.li[a] def popleft(self): for i in range(self.cnt, self.len_li): if self.b[i] == 0: self.b[i] = 1 for j in range(i + 1, self.len_li): if self.b[j] == 0: self.cnt = j break return self.li[i] return (-100, -100) def find(self, a): if a in self.ma: return True return False def remove(self, a): if self.find(a): self.b[self.ma[a]] = 1 return True return False def f(m, y, x, n): for _ in range(n): a = m.popleft() ny = y + a[0] nx = x + a[1] if not m.remove((ny, nx)): return False return True def solve(): h, w = map(int, input().split()) s = tuple(input() for _ in range(h)) c_cnt = sum(a.count('#') for a in s) if c_cnt == 0 or c_cnt & 1: return "NO" m = tuple((i, j) for i in range(h) for j in range(w) if s[i][j] == '#') a = m[0] dp = LIST(m[1:]) n = len(dp) // 2 for i in range(len(dp)): dy, dx = m[i + 1] y = dy - a[0] x = dx - a[1] if f(dp, y, x, n): return "YES" dp.reset() return "NO" print(solve())