#include <bits/stdc++.h>
using namespace std;
string S[100];
int dir[4][2] = {-1, 0, 0, 1, 1, 0, 0, -1};
bool K[100][100];
int N, M;
int si, sj;
char color;
void look(int i, int j, int step) {
  if (i == si && j == sj && step >= 4) {
    cout << "Yes" << endl;
    exit(0);
  }
  if (K[i][j]) return;
  K[i][j] = true;
  for (int y = 0; y < 4; y++) {
    int a = i + dir[y][0], b = j + dir[y][1];
    if (a >= 0 && a < N && b >= 0 && b < M && S[a][b] == color)
      look(a, b, step + 1);
  }
  K[i][j] = false;
}
int main() {
  cin >> N >> M;
  for (int i = 0; i < N; i++) cin >> S[i];
  for (int i = 0; i < N; i++)
    for (int j = 0; j < M; j++) {
      si = i;
      sj = j;
      color = S[i][j];
      look(i, j, 0);
    }
  cout << "No" << endl;
  return 0;
}
