#include <bits/stdc++.h>
using namespace std;
int visit[105][105];
char arr[105][105];
int px[] = {1, -1, 0, 0};
int n, m;
int py[] = {0, 0, 1, -1};
bool flag = 0;
void dfs(int i, int j, int prei, int prej) {
  int nextx, nexty;
  if (visit[i][j]) {
    flag = 1;
    return;
  }
  visit[i][j] = 1;
  for (int k = 0; k < 4; k++) {
    nextx = i + px[k];
    nexty = j + py[k];
    if (nextx >= 0 && nextx < n && nexty >= 0 && nexty < m &&
        arr[i][j] == arr[nextx][nexty] && !(nextx == prei && nexty == prej))
      dfs(nextx, nexty, i, j);
  }
  return;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> arr[i][j];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      memset(visit, 0, sizeof(visit));
      dfs(i, j, -1, -1);
    }
  }
  if (flag)
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}
