#include <bits/stdc++.h>
using namespace std;
char a[55][55];
int n, m, ans, endx, endy, f[55][55];
void dfs(char ch, int x, int y, int step) {
  if (ans == 1) return;
  int hang[4] = {0, 0, 1, -1};
  int lie[4] = {1, -1, 0, 0};
  if (step >= 4) {
    if (x == endx && y == endy) {
      ans = 1;
      return;
    }
  }
  int ii, jj;
  for (int i = 0; i < 4; i++) {
    ii = x + hang[i];
    jj = y + lie[i];
    if (ii >= 1 && ii <= n && jj >= 1 && jj <= m) {
      if (a[ii][jj] == ch &&
          (f[ii][jj] == 0 || ii == endx && jj == endy && step >= 4)) {
        f[ii][jj] = 1;
        dfs(ch, ii, jj, step + 1);
        if (ans == 1) return;
      }
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      ans = 0;
      endx = i;
      endy = j;
      memset(f, 0, sizeof(f));
      f[i][j] = 1;
      dfs(a[i][j], i, j, 1);
      if (ans == 1) {
        cout << "Yes";
        return 0;
      }
    }
  }
  cout << "No";
  return 0;
}
