#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const int INF = INT_MAX / 4;
int n, m, gx, gy;
vector<string> b;
bool used[51][51];
int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
int ch[] = {1, 0, 3, 2};
bool dfs(int x, int y, int cnt) {
  bool ret = 0;
  for (int i = 0; i < 4; i++) {
    int nx = x + dx[i], ny = y + dy[i];
    if (nx >= 0 && nx < m && ny >= 0 && ny < n && b[ny][nx] == b[y][x]) {
      if (gx == nx && gy == ny && cnt + 1 >= 4) {
        return 1;
      } else if (!used[ny][nx]) {
        used[ny][nx] = 1;
        ret |= dfs(nx, ny, cnt + 1);
      }
    }
  }
  return ret;
}
int main(int argc, char const *argv[]) {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    b.push_back(s);
  }
  bool ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      for (int ii = 0; ii < n; ii++) {
        for (int jj = 0; jj < m; jj++) {
          used[ii][jj] = 0;
        }
      }
      used[i][j] = 1;
      gy = i;
      gx = j;
      if (dfs(j, i, 1)) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No\n";
  return 0;
}
