#include <bits/stdc++.h>
using namespace std;
int main() {
  int h, w, n;
  cin >> h >> w;
  char str[h + 2][w + 2];
  for (int n = 0; n < w + 2; n++) {
    str[0][n] = '.';
    str[h + 1][n] = '.';
  }
  for (int j = 1; j < h + 1; j++) {
    str[j][0] = '.';
    scanf("%s", &str[j][1]);
    str[j][w + 1] = '.';
  }
  int x, y, now;
  bool f = true;
  int dx[] = {1, 0, -1, 0};
  int dy[] = {0, 1, 0, -1};
  for (int i = 1; i < h + 1; i++) {
    for (int j = 1; j < w + 1; j++) {
      now = str[i][j];
      for (int k = 0; k < 4; k++) {
        y = i + dy[k];
        x = j + dx[k];
        if (now == str[y][x]) f = false;
      }
      if (f) {
        puts("No");
        return 0;
      }
    }
  }
  puts("Yes");
  return 0;
}
