import java.util.Scanner; public class Yukicoder85 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(); String[] a = new String[n]; for (int i = 0; i < n; i++) a[i] = sc.next(); int oddCount = 0, buf; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (a[i].charAt(j) == '#') continue; buf = 0; if (i - 1 >= 0) buf += a[i - 1].charAt(j) == '.' ? 1 : 0; if (i + 1 < n) buf += a[i + 1].charAt(j) == '.' ? 1 : 0; if (j - 1 >= 0) buf += a[i].charAt(j - 1) == '.' ? 1 : 0; if (j + 1 < m) buf += a[i].charAt(j + 1) == '.' ? 1 : 0; if (buf % 2 == 0) oddCount++; } } if (oddCount % 2 == 0) System.out.println("YES"); else System.out.println("NO"); } }