#include <bits/stdc++.h>
char arr[1000][1000];
int visited[1000][1000];
int cycle = 0;
int start;
int end;
int found = 0;
void dfs(int i, int j, char looking, int cnt) {
  if (i == start && j == end && cnt >= 4) found = 1;
  if (found || arr[i][j] != looking || visited[i][j]) {
    return;
  }
  visited[i][j] = 1;
  dfs(i - 1, j, looking, cnt + 1);
  dfs(i, j - 1, looking, cnt + 1);
  dfs(i + 1, j, looking, cnt + 1);
  dfs(i, j + 1, looking, cnt + 1);
  visited[i][j] = 0;
}
int main() {
  int a, b, c, d, e, f;
  scanf("%d%d", &a, &b);
  getchar();
  int i, m;
  for (i = 0; i < a; i++) {
    gets(arr[i]);
  }
  for (i = 0; i < a; i++) {
    for (e = 0; e < b; e++) {
      start = i;
      end = e;
      dfs(i, e, arr[i][e], 0);
      if (found) {
        printf("Yes");
        return 0;
      }
    }
  }
  printf("No");
}
