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