#include <bits/stdc++.h>
using namespace std;
const int d[2][4] = {{-1, 1, 0, 0}, {0, 0, -1, 1}};
int n, m;
char s[70][70];
bool v[70][70];
bool dfs(const int &x, const int &y, const int &p, const int &q) {
  int i;
  int a, b;
  v[x][y] = true;
  for (i = 0; i < 4; i++) {
    a = x + d[0][i];
    b = y + d[1][i];
    if (a >= 0 && a < n && b >= 0 && b < m) {
      if ((a != p || b != q) && v[a][b]) return true;
      if (!v[a][b] && s[a][b] == s[x][y] && dfs(a, b, x, y)) return true;
    }
  }
  v[x][y] = false;
  return false;
}
int main(void) {
  int i, j;
  scanf("%d %d", &n, &m);
  for (i = 0; i < n; i++) scanf("%s", s[i]);
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++)
      if (dfs(i, j, -1, -1)) {
        puts("Yes");
        return 0;
      }
  puts("No");
  return 0;
}
