#include <bits/stdc++.h>
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
int n, m;
bool v[55][55], low[55][55];
char s[55][55];
void dfs(int x, int y, int x1, int y1, char c) {
  low[x][y] = 1;
  v[x][y] = 1;
  for (int i = 0; i < 4; i++) {
    int tx = x + dx[i], ty = y + dy[i];
    if (tx < 1 || tx > n || ty < 1 || ty > m) continue;
    if (s[tx][ty] != c) continue;
    if (tx == x1 && ty == y1) continue;
    if (low[tx][ty]) {
      puts("Yes");
      exit(0);
    }
    if (v[tx][ty]) continue;
    dfs(tx, ty, x, y, c);
  }
  low[x][y] = 0;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (!v[i][j]) dfs(i, j, 0, 0, s[i][j]);
  puts("No");
}
