#include <bits/stdc++.h>
const int MOD = 1000000007;
const int INF = 1000000000;
using namespace std;
int h, w;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};
string board[55];
int main(int argc, char const* argv[]) {
  cin >> h >> w;
  for (int i = 0; i < h; i++) {
    cin >> board[i];
  }
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (board[i][j] == '.') continue;
      bool ok = false;
      for (int k = 0; k < 4; k++) {
        int ny = i + dy[k];
        int nx = j + dx[k];
        if (ny < 0 || ny > h || nx > w || nx < 0)
          continue;
        else {
          if (board[i][j] == board[ny][nx]) ok = true;
        }
      }
      if (!ok) {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}
