#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<vector<int> > color;
vector<vector<char> > a;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, -1, 0, 1};
void dfs(int x, int y, int px, int py) {
  color[x][y] = 1;
  for (int i = 0; i < 4; i++) {
    if ((x + dx[i] < n) && (x + dx[i] >= 0) && (y + dy[i] < m) &&
        (y + dy[i] >= 0) && (a[x + dx[i]][y + dy[i]] == a[x][y]) &&
        ((x + dx[i] != px) || (y + dy[i] != py))) {
      if (color[x + dx[i]][y + dy[i]] == 1) {
        cout << "Yes";
        exit(0);
      }
      if (color[x + dx[i]][y + dy[i]] == 0) dfs(x + dx[i], y + dy[i], x, y);
    }
  }
  color[x][y] = 2;
}
int main() {
  cin >> n >> m;
  a.resize(n, vector<char>(m));
  color.resize(n, vector<int>(m));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> a[i][j];
  for (int w = 0; w < n; w++)
    for (int j = 0; j < m; j++)
      if (color[w][j] == 0) dfs(w, j, -1, -1);
  cout << "No";
  return 0;
}
