#include <bits/stdc++.h>
using namespace std;
const int infinity = 0x3f3f3f3f;
char table[60][60];
int marked[60][60];
int N, M;
int ri[4] = {0, -1, 0, 1};
int rj[4] = {-1, 0, 1, 0};
bool dfs(int a, int b, int fa, int fb) {
  if (a < 0 || a > N || b < 0 || b > M) return false;
  if (marked[a][b])
    return true;
  else {
    marked[a][b] = true;
    bool ans = false;
    for (int k = 0; k < 4; k++) {
      if ((a + ri[k] != fa || b + rj[k] != fb) &&
          table[a + ri[k]][b + rj[k]] == table[a][b])
        ans |= dfs(a + ri[k], b + rj[k], a, b);
    }
    return ans;
  }
}
bool aller() {
  for (int n = 0; n < N; n++) {
    for (int m = 0; m < M; m++) {
      if (!marked[n][m] && dfs(n, m, -1, -1)) return true;
    }
  }
  return false;
}
int main() {
  scanf("%d%d", &N, &M);
  for (int n = 0; n < N; n++) scanf("%s", table[n]);
  memset(marked, false, sizeof(marked));
  bool r = aller();
  if (r)
    printf("Yes\n");
  else
    printf("No\n");
}
