#include <bits/stdc++.h>
using namespace std;
int n, m;
char s[55][55];
bool vis[55][55], flag = false;
int dx[5] = {0, 1, 0, 0, -1}, dy[5] = {0, 0, -1, 1, 0};
void dfs(int x, int y, int dir, char c) {
  if (s[x][y] != c) return;
  if (vis[x][y]) {
    flag = true;
    return;
  }
  vis[x][y] = true;
  for (int i = 1; i <= 4; i++) {
    if (i == dir) continue;
    dfs(x + dx[i], y + dy[i], 5 - i, c);
  }
}
int main() {
  scanf("%d %d", &n, &m);
  memset(s, '.', sizeof(s));
  memset(vis, false, sizeof(vis));
  for (int i = 1; i <= n; i++) {
    scanf("%s", s[i] + 1);
    s[i][m + 1] = '.';
  }
  for (int i = 1; i <= n && !flag; i++) {
    for (int j = 1; j <= m && !flag; j++) {
      if (!vis[i][j]) dfs(i, j, 0, s[i][j]);
    }
  }
  if (flag)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
