#include <bits/stdc++.h>
using namespace std;
int n, m;
int vis[60][60];
int vis2[60][60];
int flag;
char s[60][60];
int dirx[] = {0, 1, 0, -1};
int diry[] = {1, 0, -1, 0};
void ini() {
  int i, j;
  memset(vis, 0, sizeof(vis));
  memset(vis2, 0, sizeof(vis2));
  for (i = 0; i <= n + 3; i++) {
    for (j = 0; j <= m + 3; j++) {
      s[i][j] = 'z';
    }
  }
  flag = 0;
  for (i = 1; i <= n; i++) {
    scanf("%s", s[i] + 1);
  }
}
void dfs(int fx, int fy, int x, int y, char now, int cnt) {
  int i;
  int nx, ny;
  if (flag == 1) return;
  for (i = 0; i < 4; i++) {
    nx = x + dirx[i];
    ny = y + diry[i];
    if (s[nx][ny] != now) continue;
    if (nx == fx && ny == fy) continue;
    if (vis2[nx][ny] == 1) {
      if (cnt >= 4) {
        flag = 1;
        return;
      } else {
        continue;
      }
    }
    if (vis[nx][ny] == 1) continue;
    vis[nx][ny] = 1;
    vis2[nx][ny] = 1;
    dfs(x, y, nx, ny, now, cnt + 1);
    vis2[nx][ny] = 0;
  }
}
void solve() {
  int i, j;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      if (vis[i][j] == 1) continue;
      vis[i][j] = 1;
      memset(vis2, 0, sizeof(vis2));
      vis2[i][j] = 1;
      dfs(0, 0, i, j, s[i][j], 1);
    }
  }
}
void out() {
  if (flag == 0) {
    printf("No\n");
  } else {
    printf("Yes\n");
  }
}
int main() {
  while (scanf("%d%d", &n, &m) != EOF) {
    ini();
    solve();
    out();
  }
  return 0;
}
