#include <bits/stdc++.h>
using namespace std;
const int GOD = 55;
int N, M;
char a[GOD][GOD];
bool good;
bool was[GOD][GOD];
int dirX[] = {0, 0, -1, 1};
int dirY[] = {1, -1, 0, 0};
bool within(int p, int q) { return p >= 0 && q >= 0 && p < N && q < M; }
bool dfs(int x, int y, int px, int py, char c) {
  was[x][y] = true;
  for (int i = 0; i < 4; i++) {
    int new_X = x + dirX[i];
    int new_Y = y + dirY[i];
    if (new_X == px && new_Y == py) continue;
    if (within(new_X, new_Y) && a[new_X][new_Y] == c) {
      if (was[new_X][new_Y] == false) {
        if (dfs(new_X, new_Y, x, y, c)) return true;
      } else if (was[new_X][new_Y])
        return true;
    }
  }
  return false;
}
int main() {
  cin >> N >> M;
  for (int i = 0; i < N; i++)
    for (int j = 0; j < M; j++) cin >> a[i][j];
  for (int i = 0; i < N; i++)
    for (int j = 0; j < M; j++)
      if (was[i][j] == false)
        if (dfs(i, j, -1, -1, a[i][j])) good = true;
  printf((good) ? "Yes\n" : "No\n");
  return 0;
}
