#include <bits/stdc++.h>
using namespace std;
int n, m;
char ma[100][100];
bool vis[100][100];
bool flag = 0;
int dx[] = {0, 0, 1, -1};
int dy[] = {
    1,
    -1,
    0,
    0,
};
void bfs(int x, int y, int curx, int cury) {
  if (vis[x][y]) {
    flag = true;
    return;
  }
  vis[x][y] = true;
  int nx, ny;
  for (int i = 0; i < 4; i++) {
    nx = x + dx[i];
    ny = y + dy[i];
    if (nx == curx && ny == cury) continue;
    if (ma[nx][ny] == ma[x][y]) bfs(nx, ny, x, y);
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%s", ma[i] + 1);
  }
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (!vis[i][j]) bfs(i, j, i, j);
      if (flag) break;
    }
    if (flag) break;
  }
  if (flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
