#include <bits/stdc++.h>
using namespace std;
const int INF = 1e6;
int m, n;
vector<string> f;
int **a;
bool in(int x, int y) { return x >= 0 && x < m && y >= 0 && y < n; }
bool same(int x, int y, int px, int py) {
  if (!in(x, y)) return false;
  return f[y][x] == f[py][px];
}
bool may(int x, int y, int px, int py) {
  if (!same(x, y, px, py)) return false;
  return a[y][x] == INF;
}
int abs(int a) {
  if (a < 0) a = -a;
  return a;
}
bool is_cycle(int x, int y, int px = -1, int py = -1) {
  if (a[y][x] != INF) return false;
  if (px == -1) {
    a[y][x] = 0;
  } else {
    a[y][x] = a[py][px] + 1;
  }
  for (int dx = -1; dx <= 1; dx++) {
    for (int dy = -1; dy <= 1; dy++) {
      if (abs(dx) + abs(dy) != 1) continue;
      int nx = x + dx;
      int ny = y + dy;
      if (same(nx, ny, x, y) && a[y][x] - a[ny][nx] >= 3) return true;
      if (may(nx, ny, x, y) && is_cycle(nx, ny, x, y)) return true;
    }
  }
  return false;
}
int main() {
  cin >> n >> m;
  f.resize(n);
  for (int i = 0; i < n; i++) cin >> f[i];
  a = new int *[n];
  for (int i = 0; i < n; i++) {
    a[i] = new int[m];
    for (int j = 0; j < m; j++) {
      a[i][j] = INF;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (is_cycle(j, i)) {
        cout << "Yes";
        return 0;
      }
    }
  }
  cout << "No";
  return 0;
}
