#include <bits/stdc++.h>
const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
int n, m;
char mp[55][55];
bool vis[55][55], flag, hasans;
void dfs(int startx, int starty, int curx, int cury, int lastx, int lasty) {
  if (flag && curx == startx && cury == starty) {
    hasans = 1;
    return;
  }
  if (vis[curx][cury]) {
    return;
  }
  vis[curx][cury] = 1;
  flag = 1;
  for (int i = 0; i < 4; ++i) {
    int nx = curx + dx[i], ny = cury + dy[i];
    if (nx < 1 || nx > n || ny < 1 || ny > m) {
      continue;
    }
    if (mp[nx][ny] != mp[startx][starty]) {
      continue;
    }
    if (nx == lastx && ny == lasty) {
      continue;
    }
    dfs(startx, starty, nx, ny, curx, cury);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%s", mp[i] + 1);
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      memset(vis, 0, sizeof(vis));
      flag = 0;
      dfs(i, j, i, j, 0, 0);
      if (hasans) {
        puts("Yes");
        return 0;
      }
    }
  }
  puts("No");
  return 0;
}
