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