#include <bits/stdc++.h>
using namespace std;
int n, m;
char grid[55][55];
int vis[55][55];
int cnt = 1;
bool dfs(int r, int c, int cnt) {
  vis[r][c] = cnt;
  int cr = grid[r][c];
  if (grid[r - 1][c] == cr) {
    if (vis[r - 1][c] && vis[r - 1][c] - vis[r][c] != -1)
      return true;
    else if (!vis[r - 1][c] && dfs(r - 1, c, cnt + 1))
      return true;
  }
  if (grid[r][c + 1] == cr) {
    if (vis[r][c + 1] && vis[r][c + 1] - vis[r][c] != -1)
      return true;
    else if (!vis[r][c + 1] && dfs(r, c + 1, cnt + 1))
      return true;
  }
  if (grid[r + 1][c] == cr) {
    if (vis[r + 1][c] && vis[r + 1][c] - vis[r][c] != -1)
      return true;
    else if (!vis[r + 1][c] && dfs(r + 1, c, cnt + 1))
      return true;
  }
  if (grid[r][c - 1] == cr) {
    if (vis[r][c - 1] && vis[r][c - 1] - vis[r][c] != -1)
      return true;
    else if (!vis[r][c - 1] && dfs(r, c - 1, cnt + 1))
      return true;
  }
  return false;
}
int main() {
  scanf("%d %d", &n, &m);
  getchar();
  for (int i = 0; i <= m + 1; i++)
    grid[0][i] = grid[n + 1][i] = grid[i][0] = grid[i][m + 1] = '.';
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%c", &grid[i][j]);
    }
    getchar();
  }
  bool res = false;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (!vis[i][j]) {
        res = dfs(i, j, cnt);
        if (res) break;
      }
    }
    if (res) break;
  }
  if (res)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
