#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int i = 0, j = 0;
  string bw[60];
  int h, w;
  cin >> h >> w;
  for (i = 0; i < h; i++) {
    cin >> bw[i];
  }
  int check = 0;
  for (i = 1; i < h - 1; i++) {
    for (j = 1; j < w - 1; j++) {
      if (bw[i][j] == bw[i - 1][j]) {
        check = 1;
      }
      if (bw[i][j] == bw[i + 1][j]) {
        check = 1;
      }
      if (bw[i][j] == bw[i][j - 1]) {
        check = 1;
      }
      if (bw[i][j] == bw[i][j + 1]) {
        check = 1;
      }
    }
  }
  if (check) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
