#include <bits/stdc++.h>
using namespace std;
int n, m;
char jadval[100][100];
bool mark[100][100];
void dfs(int i, int j, int x, int y) {
  if (mark[i][j]) {
    cout << "Yes";
    exit(0);
  }
  mark[i][j] = true;
  if (jadval[i][j] == jadval[i + 1][j] && i + 1 != x) dfs(i + 1, j, i, j);
  if (jadval[i][j] == jadval[i][j + 1] && j + 1 != y) dfs(i, j + 1, i, j);
  if (jadval[i][j] == jadval[i - 1][j] && i - 1 != x) dfs(i - 1, j, i, j);
  if (jadval[i][j] == jadval[i][j - 1] && j - 1 != y) dfs(i, j - 1, i, j);
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> jadval[i][j];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (!mark[i][j]) dfs(i, j, -10, -10);
  cout << "No";
}
