#include <bits/stdc++.h>
using namespace std;
char a[55][55];
int y[] = {-1, 1, 0, 0};
int x[] = {0, 0, -1, 1};
int vis[55][55];
int n, m, flag = 0;
void dfs(int p, int q, int r, int u) {
  int i, s, t, j, l;
  vis[p][q] = a[p][q];
  for (i = 0; i < 4; i++) {
    s = p + x[i];
    t = q + y[i];
    if (s >= n || s < 0 || t >= m || t < 0) continue;
    if (vis[s][t] == vis[p][q] && (s != r || t != u) && (r != 0 || u != 0)) {
      flag = 1;
    }
    if (vis[s][t] == 0) {
      if (a[p][q] == a[s][t]) {
        vis[s][t] = vis[p][q];
        dfs(s, t, p, q);
      }
    }
  }
  return;
}
int main() {
  int i, j;
  scanf("%d %d", &n, &m);
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  memset(vis, 0, sizeof(vis));
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      dfs(i, j, 0, 0);
      if (flag == 1) break;
    }
    if (flag == 1) break;
  }
  if (flag == 1)
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}
