#include <bits/stdc++.h>
using namespace std;
string field[57];
int flag[57][57];
bool f = 0;
int n, m, cas = 0;
int dir[4][2] = {1, 0, -1, 0, 0, 1, 0, -1};
void dfs(int x, int y, int prex, int prey) {
  flag[x][y] = cas;
  for (int i = 0; i < 4; i++) {
    int nextx = x + dir[i][0];
    int nexty = y + dir[i][1];
    if ((nextx != prex || nexty != prey) && nextx >= 0 && nextx < n &&
        nexty >= 0 && nexty < m) {
      if (field[nextx][nexty] == field[x][y]) {
        if (!flag[nextx][nexty])
          dfs(nextx, nexty, x, y);
        else if (flag[nextx][nexty] == flag[x][y])
          f = 1;
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> field[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (!flag[i][j]) {
        cas++;
        dfs(i, j, -1, -1);
      }
  if (f)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
