#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
const int MAXN = 50 + 10;
const int MOD = 29;
const int dir[][2] = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}};
int cases = 0;
int vis[MAXN][MAXN], row, col;
char mp[MAXN][MAXN];
bool DFS(int x, int y, char color, int step) {
  for (int i = 0; i < 4; i++) {
    int xx = x + dir[i][0], yy = y + dir[i][1];
    if (xx < 0 || xx >= row || yy < 0 || yy >= col) continue;
    if (mp[xx][yy] != color) continue;
    if (vis[xx][yy]) {
      if (mp[xx][yy] != color || step - vis[xx][yy] == 1) continue;
      return true;
    }
    vis[xx][yy] = step + 1;
    if (DFS(xx, yy, color, step + 1)) return true;
  }
  return false;
}
int main() {
  scanf("%d%d", &row, &col);
  for (int i = 0; i < row; i++) scanf("%s", mp[i]);
  bool flag = false;
  for (int i = 0; i < row; i++)
    for (int j = 0; j < col; j++) {
      if (!vis[i][j]) {
        vis[i][j] = 1;
        flag = DFS(i, j, mp[i][j], 1);
      }
      if (flag) {
        puts("Yes");
        return 0;
      }
    }
  puts("No");
  return 0;
}
