#include <bits/stdc++.h>
using namespace std;
bool vis[100][100];
char a[100][100];
bool dp[100][100];
bool flag = 0;
int ii, jj;
void rec(char c, int i, int j) {
  if (vis[i][j] || flag || dp[i][j]) return;
  vis[i][j] = 1;
  if (i == ii - 1 && j == jj || i == i + 1 && j == jj) {
    flag = 1;
    return;
  }
  if (a[i][j + 1] == c) rec(a[i][j + 1], i, j + 1);
  if (a[i][j - 1] == c) rec(a[i][j - 1], i, j - 1);
  if (i != ii || j != jj) {
    if (a[i + 1][j] == c) rec(a[i + 1][j], i + 1, j);
    if (a[i - 1][j] == c) rec(a[i - 1][j], i - 1, j);
  }
  vis[i][j] = 0;
}
int main() {
  int m, n;
  cin >> m >> n;
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n; j++) cin >> a[i][j];
  for (int k = m - 1; k >= 0; k--)
    for (int l = 0; l < n; l++) {
      ii = k;
      jj = l;
      rec(a[k][l], k, l);
      if (flag) {
        cout << "Yes" << endl;
        return 0;
      }
      dp[k][l] = 1;
    }
  cout << "No" << endl;
}
