def cond(right, left): rx = sorted(right, key=lambda ax:ax[0]^2 + ax[1]^2) lx = sorted(left, key=lambda ax:ax[0]^2 + ax[1]^2) rhead, *rrest = rx lhead, *lrest = lx diff = (rhead[0] - lhead[0], rhead[1] - lhead[1]) for rr in rrest: rrd = (rr[0] + diff[0], rr[1] + diff[1]) if not rrd in lrest: return False return True if __name__ == "__main__": s = input() h, w = [int(i) for i in s.split(" ")] cellz = [] for hi in range(h): s = input() for wi, ch in enumerate(s): if ch == "#": cellz.append((hi, wi)) if len(cellz) % 2 == 1: print("NO") else: maxcell = len(cellz) grpsize = maxcell // 2 def func(cand, s, e): if len(cand) == grpsize: right = [ cellz[i] for i in range(maxcell) if i in cand] left = [ cellz[i] for i in range(maxcell) if i not in cand] return cond(right, left) else: for i in range(s, e+1): if func(cand + [i], i + 1, e + 1): return True return False if func([], 0, grpsize): print("YES") else: print("NO")