#include <bits/stdc++.h>
using namespace std;
char ss[60][60];
int arr[60][60], n, m;
int path[60][60];
int fx[] = {1, -1, 0, 0};
int fy[] = {0, 0, -1, 1};
int bfs(int a, int b) {
  if ((a + 1) >= n) return 0;
  if ((b + 1) >= m) return 0;
  int x1, y1, x2, y2;
  x1 = a;
  y1 = b + 1;
  x2 = a + 1;
  y2 = b;
  if (arr[x1][y1] != arr[a][b] or arr[a][b] != arr[x2][y2]) return 0;
  arr[a][b] = -111;
  a = x2;
  b = y2;
  memset(path, 0, sizeof path);
  queue<pair<int, int> > Q;
  Q.push(make_pair(x1, y1));
  path[x1][y1] = 1;
  while (!Q.empty()) {
    pair<int, int> u = Q.front();
    Q.pop();
    int val = arr[u.first][u.second];
    for (int i = 0; i < 4; i++) {
      int x = fx[i] + u.first, y = fy[i] + u.second;
      if (x == a and y == b) return 1;
      if (path[x][y] == 0 and x < n and x >= 0 and y < m and y >= 0 and
          arr[x][y] == val) {
        path[x][y] = 1;
        Q.push(make_pair(x, y));
      }
    }
  }
  return 0;
}
int main() {
  int a, b, c, d, f = 0;
  scanf("%d %d", &n, &m);
  for (a = 0; a < n; a++) scanf("%s", ss[a]);
  memset(arr, 0, sizeof arr);
  for (a = 0; a < n; a++) {
    for (b = 0; b < m; b++) {
      arr[a][b] = (ss[a][b] - 64);
    }
  }
  for (a = 0; a < n; a++) {
    for (b = 0; b < m; b++) {
      d = arr[a][b];
      f = bfs(a, b);
      arr[a][b] = d;
      if (f == 1) {
        break;
      }
    }
    if (f == 1) break;
  }
  puts(f == 1 ? "Yes" : "No");
  return 0;
}
