#include <bits/stdc++.h>
using namespace std;
int N, M;
char arr[55][55];
bool vis[55][55] = {0};
bool yes(int x, int y, int pr1, int pr2) {
  if (x < 0 || x >= N || y < 0 || y >= M || arr[x][y] != arr[pr1][pr2])
    return 0;
  if (vis[x][y]) return 1;
  vis[x][y] = 1;
  int sum = 0;
  if (x - 1 != pr1 || y != pr2) sum += yes(x - 1, y, x, y);
  if (x + 1 != pr1 || y != pr2) sum += yes(x + 1, y, x, y);
  if (x != pr1 || y + 1 != pr2) sum += yes(x, y + 1, x, y);
  if (x != pr1 || y - 1 != pr2) sum += yes(x, y - 1, x, y);
  return sum;
}
int main() {
  cin >> N >> M;
  for (int i = 0; i < N; i++) cin >> arr[i];
  arr[54][54] = 'a';
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      if (!vis[i][j]) {
        arr[54][54] = arr[i][j];
        if (yes(i, j, 54, 54)) {
          cout << "Yes";
          return 0;
        }
      }
    }
  }
  cout << "No";
  return 0;
}
