H, W = map(int, input().strip().split(' ')) odd = 0 even = 0 for i in range(H): row = input().strip() for j in range(W): if row[j] != 'o': continue state = H - i + j if state % 2 == 0: even += 1 else: odd += 1 if odd % 2 == 1: if even % 2 == 1: if odd == 1: print('YES') else: print('NO') else: if odd == 1: print('NO') else: print('YES') else: if even % 2 == 1: if odd == 0: print('NO') else: print('YES') else: if odd == 0: print('YES') else: print('NO')