#include <bits/stdc++.h>
using namespace std;
int n, m;
char a[100][100];
bool visit[100][100], ok = 0;
const int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, -1, 0, 1};
void dfs(int x, int y, int xx, int yy) {
  visit[x][y] = 1;
  for (int i = 0; i < 4; i++) {
    if (a[x + dx[i]][y + dy[i]] == a[x][y] &&
        (x + dx[i] != xx || y + dy[i] != yy)) {
      if (visit[x + dx[i]][y + dy[i]]) {
        ok = 1;
      } else {
        dfs(x + dx[i], y + dy[i], x, y);
      }
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (!visit[i][j]) {
        dfs(i, j, -1, -1);
      }
    }
  }
  if (ok) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
