#include <bits/stdc++.h>
char map[55][55];
int cov[55][55];
int fx[4][2] = {{0, 1}, {1, 0}, {-1, 0}, {0, -1}};
int ok, sx, sy;
int steps[55][55];
int n, m;
int in(int x, int y) {
  if (x >= 1 && x <= n && y >= 1 && y <= m) return 1;
  return 0;
}
void dfs(int x, int y, int step) {
  steps[x][y] = step;
  if (ok) return;
  for (int i = 0; i < 4; i++) {
    int xx = x + fx[i][0];
    int yy = y + fx[i][1];
    if (in(xx, yy) && map[xx][yy] == map[sx][sy]) {
      if (cov[xx][yy]) {
        if (step - steps[xx][yy] >= 3) {
          ok = 1;
          return;
        }
        continue;
      }
      cov[xx][yy] = 1;
      dfs(xx, yy, step + 1);
    }
  }
}
int main() {
  while (~scanf("%d%d", &n, &m)) {
    for (int i = 1; i <= n; i++) {
      scanf("%s", map[i] + 1);
    }
    ok = 0;
    memset(cov, 0, sizeof(cov));
    memset(steps, 0, sizeof(steps));
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        if (cov[i][j]) continue;
        ok = 0;
        sx = i;
        sy = j;
        steps[i][j] = 1;
        cov[i][j] = 1;
        dfs(i, j, 1);
        if (ok) break;
      }
      if (ok) break;
    }
    if (ok)
      printf("Yes\n");
    else
      printf("No\n");
  }
  return 0;
}
