#include <bits/stdc++.h>
using namespace std;
int n, m, fx, fy, len = 1;
char grid[55][55];
int vis[55][55];
int X[] = {0, 0, 1, -1};
int Y[] = {-1, 1, 0, 0};
bool sol = false;
bool inside(int x, int y) { return x >= 0 && x < n && y >= 0 && y < m; }
void dfs(int x, int y, int fx, int fy) {
  if (sol) return;
  vis[x][y] = 1;
  for (int k = 0; k < 4; k++) {
    int nx = x + X[k];
    int ny = y + Y[k];
    if (nx == fx && ny == fy) continue;
    if (inside(nx, ny) && grid[x][y] == grid[nx][ny]) {
      if (vis[nx][ny]) {
        sol = true;
        return;
      } else
        dfs(nx, ny, x, y);
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> grid[i][j];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      if (!vis[i][j]) {
        dfs(i, j, -1, -1);
      }
    }
  if (sol)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
