#include <bits/stdc++.h>
int n, m;
char map[51][51];
int scanCell(int l, int c) {
  extern int n, m;
  extern char map[51][51];
  char point = map[l][c];
  int count = 0;
  if (c + 1 <= m && point == map[l][c + 1]) {
    count += 1;
  }
  if (l + 1 <= n && point == map[l + 1][c]) {
    count += 1;
  }
  if (c - 1 > -1 && point == map[l][c - 1]) {
    count += 1;
  }
  if (l - 1 > -1 && point == map[l - 1][c]) {
    count += 1;
  }
  if (count < 2) {
    map[l][c] = '0';
    return 1;
  }
  return 0;
}
int main(void) {
  extern int n, m;
  extern char map[51][51];
  int i, j;
  scanf("%d %d", &n, &m);
  for (i = 0; i < n; i++) scanf("%s", map[i]);
  int cont;
  do {
    cont = 0;
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        if (map[i][j] != '0') {
          cont += scanCell(i, j);
        }
      }
    }
  } while (cont);
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (map[i][j] != '0') {
        printf("Yes");
        return 0;
      }
    }
  }
  printf("No");
  return 0;
}
