#include <bits/stdc++.h>
using namespace std;
int col[100][100], st;
char a[100][100];
struct an {
  int x;
  int y;
};
an parent[100][100];
int dfs(char c, int i, int j) {
  if (a[i + 1][j] == c && col[i + 1][j] == 0 && st == 0) {
    parent[i + 1][j].x = i;
    parent[i + 1][j].y = j;
    col[i][j] = 1;
    dfs(c, i + 1, j);
  }
  if (a[i][j - 1] == c && col[i][j - 1] == 0 && st == 0) {
    parent[i][j - 1].x = i;
    parent[i][j - 1].y = j;
    col[i][j] = 1;
    dfs(c, i, j - 1);
  }
  if (a[i][j + 1] == c && col[i][j + 1] == 0 && st == 0) {
    parent[i][j + 1].x = i;
    parent[i][j + 1].y = j;
    col[i][j] = 1;
    dfs(c, i, j + 1);
  }
  if (a[i - 1][j] == c && col[i - 1][j] == 0 && st == 0) {
    parent[i - 1][j].x = i;
    parent[i - 1][j].y = j;
    col[i][j] = 1;
    dfs(c, i - 1, j);
  }
  if (a[i][j - 1] == c && col[i][j - 1] == 1 && st == 0) {
    if (i != parent[i][j].x || j - 1 != parent[i][j].y) {
      st = 1;
      return 1;
    } else
      col[i][j] = 2;
  }
  if (a[i][j + 1] == c && col[i][j + 1] == 1 && st == 0) {
    if (i != parent[i][j].x || j + 1 != parent[i][j].y) {
      st = 1;
      return 1;
    } else
      col[i][j] = 2;
  }
  if (a[i + 1][j] == c && col[i + 1][j] == 1 && st == 0) {
    if (i + 1 != parent[i][j].x || j != parent[i][j].y) {
      st = 1;
      return 1;
    } else
      col[i][j] = 2;
  }
  if (a[i - 1][j] == c && col[i - 1][j] == 1 && st == 0) {
    if (i - 1 != parent[i][j].x || j != parent[i][j].y) {
      st = 1;
      return 1;
    } else
      col[i][j] = 2;
  }
  if (st == 0)
    return 0;
  else
    return 1;
}
int main() {
  int i, j, l, n, m, k;
  while (scanf("%d %d", &n, &m) != EOF) {
    for (i = 0; i <= 80; i++) {
      for (j = 0; j <= 80; j++) a[i][j] = '.';
    }
    for (i = 1; i <= n; i++) {
      for (j = 1; j <= m; j++) scanf(" %c", &a[i][j]);
    }
    k = 0;
    memset(col, 0, sizeof(col));
    st = 0;
    for (i = 1; i <= n && k == 0; i++) {
      for (j = 1; j <= m && k == 0; j++) {
        if (col[i][j] == 0) {
          k = dfs(a[i][j], i, j);
        }
      }
    }
    if (k == 0)
      printf("No\n");
    else
      printf("Yes\n");
  }
  return 0;
}
