#include <bits/stdc++.h>
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e2 + 5;
const double eps = 1e-9;
using namespace std;
char tmp[MAXN];
int a[MAXN][MAXN], vis[MAXN][MAXN];
pair<int, int> st[40];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int n, m, fl = 0;
void dfs(int x, int y, int c, int px, int py) {
  if (a[x][y] != c) return;
  if (vis[x][y]) {
    fl = 1;
    return;
  }
  vis[x][y] = 1;
  for (int i = 0; i < 4; i++) {
    int nx = x + dx[i], ny = y + dy[i];
    if (nx < 0 || ny < 0 || nx >= n || ny >= m) continue;
    if (a[nx][ny] != c) continue;
    if (nx == px && ny == py) continue;
    dfs(nx, ny, c, x, y);
  }
}
int main() {
  scanf("%d", &(n)), scanf("%d", &(m));
  for (int i = 0; i < n; i++) {
    scanf("%s", tmp);
    for (int j = 0; j < m; j++) a[i][j] = tmp[j] - 'A';
  }
  for (int i = 0; i < 40; i++) {
    memset(vis, 0, sizeof vis);
    for (int a = 0; a < n; a++)
      for (int b = 0; b < m; b++)
        if (!vis[a][b]) dfs(a, b, i, -1, -1);
  }
  if (fl)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
