#include <bits/stdc++.h>
using namespace std;
bool visited[51][51];
int n, m;
char arr[51][51];
bool prkSol(int i, int j, int a, int b) {
  if (visited[i][j]) return true;
  int ctr = 0, p = -1, q = -1, r = -1, s = -1, t = -1, u = -1, v = -1, w = -1;
  visited[i][j] = 1;
  if ((i - 1) >= 0 && arr[i - 1][j] == arr[i][j]) {
    ctr++;
    p = i - 1;
    q = j;
  }
  if ((i + 1) < n && arr[i][j] == arr[i + 1][j]) {
    ctr++;
    r = i + 1;
    s = j;
  }
  if ((j - 1) >= 0 && arr[i][j - 1] == arr[i][j]) {
    ctr++;
    t = i;
    u = j - 1;
  }
  if ((j + 1) < m && arr[i][j + 1] == arr[i][j]) {
    ctr++;
    v = i;
    w = j + 1;
  }
  if (ctr >= 2) {
    if (!(p == a && q == b))
      if (p >= 0 && q >= 0 && prkSol(p, q, i, j)) return true;
    visited[p][q] = 0;
    if (!(r == a && s == b))
      if (r >= 0 && s >= 0 && prkSol(r, s, i, j)) return true;
    visited[r][s] = 0;
    if (!(t == a && u == b))
      if (t >= 0 && u >= 0 && prkSol(t, u, i, j)) return true;
    visited[t][u] = 0;
    if (!(v == a && w == b))
      if (v >= 0 && w >= 0 && prkSol(v, w, i, j)) return true;
    visited[v][w] = 0;
  }
  visited[i][j] = 0;
  return false;
}
int main() {
  int i, j;
  cin >> n >> m;
  for (i = 0; i < n; i++) cin >> arr[i];
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (visited[i][j] == 0) {
        if (prkSol(i, j, -1, -1)) {
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  }
  cout << "No" << endl;
  return 0;
}
