#include <bits/stdc++.h>
using namespace std;
int main() {
  int h, w;
  char s[55][55];
  cin >> h >> w;
  for (int i = 0; i < h + 2; i++) {
    for (int j = 0; j < w + 2; j++) {
      if (i == 0 || i == (h + 1)) {
        s[i][j] = '%';
      }
      if (j == 0 || j == (w + 1)) {
        s[i][j] = '%';
      } else {
        cin >> s[i][j];
      }
    }
  }
  for (int i = 1; i < h + 1; i++) {
    for (int j = 1; j < (w + 1); j++) {
      if (s[i][j] != s[i][j - 1] && s[i][j] != s[i][j + 1] &&
          s[i - 1][j] != s[i][j] && s[i][j] != s[i + 1][j]) {
        cout << "No" << endl;
        break;
      }
      if (i == h && j == w) {
        cout << "Yes" << endl;
      }
    }
  }
  return 0;
}
