#include <bits/stdc++.h>
using namespace std;
int main() {
  int H, W, c = 0, i, j;
  char S[60][60];
  cin >> H >> W;
  for (i = 0; i < H; i++) {
    for (j = 0; j < W; j++) {
      cin >> S[i][j];
    }
  }
  for (i = 1; i < H; i++) {
    for (j = 1; j < W; j++) {
      if (S[i][j] != S[i - 1][j] && S[i][j] != S[i + 1][j] &&
          S[i][j] != S[i][j - 1] && S[i][j] != S[i][j + 1]) {
        c++;
      }
    }
  }
  if (c != 0) {
    cout << "No";
  } else {
    cout << "Yes";
  }
}
