# coding: utf-8 from collections import deque H, W = map(int, input().split()) # board[H][W] board = [list(input()) for __ in range(H)] sum_char = 0 index_board = [] for ind_h, row in enumerate(board): for ind_w, char in enumerate(row): if char == "#": sum_char += 1 index_board.append((ind_h, ind_w)) def check(h, w): do_board = deque(index_board[:]) while do_board: check_index = do_board.popleft() if (check_index[0] + h, check_index[1] + w) in do_board: do_board.remove((check_index[0] + h, check_index[1] + w)) else: break else: return True return False def solve(): if sum_char % 2 == 1: return "NO" for h in range(H): for w in range(W): # print("h: {0}, w: {1}".format(h, w)) if check(h, w): return "YES" else: continue return "NO" print(solve())