#include <bits/stdc++.h>
using namespace std;
char s[56][56];
int vis[56][56];
int n, m;
int xx[4] = {0, -1, 1, 0};
int yy[4] = {1, 0, 0, -1};
char tt;
int mark;
int judge(int x, int y) {
  if (x >= 0 && x < n && y >= 0 && y < m)
    return 1;
  else
    return 0;
}
void dfs(int x, int y, int fx, int fy) {
  if (!judge(x, y)) return;
  vis[x][y] = 1;
  for (int i = 0; i < 4; i++) {
    int tx = x + xx[i];
    int ty = y + yy[i];
    if (judge(tx, ty) && s[x][y] == s[tx][ty] && (tx != fx || ty != fy)) {
      if (vis[tx][ty]) {
        mark = 1;
        return;
      }
      dfs(tx, ty, x, y);
    }
  }
  return;
}
int main() {
  while (~scanf("%d%d", &n, &m)) {
    memset(vis, 0, sizeof(vis));
    for (int i = 0; i < n; i++) {
      scanf("%s", s[i]);
    }
    mark = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (!vis[i][j]) {
          dfs(i, j, -1, -1);
          if (mark) {
            printf("Yes\n");
            return 0;
          }
        }
      }
    }
    printf("No\n");
  }
}
