#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int _max = 55;
typedef int ints[_max];
int n, m;
char mp[_max][_max];
ints vis[_max];
bool ok;
const int dir[4][2] = {0, 1, 1, 0, 0, -1, -1, 0};
int tx, ty;
char c;
bool check(int x, int y) {
  return x >= 1 && x <= n && y >= 1 && y <= m && mp[x][y] == c;
}
bool dfs(int x, int y, int sp) {
  for (int i = 0; i < 4; i++) {
    tx = x + dir[i][0];
    ty = y + dir[i][1];
    if (check(tx, ty)) {
      if (!vis[tx][ty]) {
        vis[tx][ty] = sp + 1;
        if (dfs(tx, ty, vis[tx][ty])) return 1;
      } else if (sp - vis[tx][ty] >= 3)
        return 1;
    }
  }
  return 0;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", mp[i] + 1);
  for (int i = 1; !ok && i <= n; i++)
    for (int j = 1; !ok && j <= m; j++)
      if (!vis[i][j]) {
        vis[i][j] = 1;
        c = mp[i][j];
        ok = dfs(i, j, vis[i][j]);
      }
  printf("%s", ok ? "Yes" : "No");
  return 0;
}
