#include <bits/stdc++.h>
using namespace std;
int n, m, t = 0, visit[55][55], x, y;
int mx[4] = {0, 0, 1, -1};
int my[4] = {1, -1, 0, 0};
char s[55][55], u;
void dfs(int a, int b, int k) {
  if (!t) {
    visit[a][b] = 1;
    int i;
    for (i = 0; i < 4; i++) {
      if (s[a + mx[i]][b + my[i]] == u && a + mx[i] == x && b + my[i] == y &&
          k >= 4) {
        t = 1;
      } else if (s[a + mx[i]][b + my[i]] == u && !visit[a + mx[i]][b + my[i]])
        dfs(a + mx[i], b + my[i], k + 1);
    }
  }
}
int main() {
  int i, k;
  cin >> n >> m;
  getchar();
  for (i = 0; i < 55; i++)
    for (k = 0; k < 55; k++) s[i][k] = '.';
  for (i = 1; i <= n; i++) {
    for (k = 1; k <= m; k++) cin >> s[i][k];
    getchar();
  }
  for (i = 1; i <= n; i++) {
    for (k = 1; k <= m; k++) {
      if (t) break;
      memset(visit, 0, sizeof(visit));
      x = i;
      y = k;
      u = s[x][y];
      dfs(x, y, 1);
    }
  }
  if (t)
    puts("Yes");
  else
    puts("No");
}
