#include <bits/stdc++.h>
using namespace std;
long long n, m, u, v, k;
long long row[4] = {1, -1, 0, 0};
long long col[4] = {0, 0, 1, -1};
bool mark[505][505];
char a[505][505];
bool isSafe(long long x, long long y, char c) {
  return x >= 0 && x < n && y >= 0 && y < m && a[x][y] == c;
}
long long flag;
long long sz;
void check(long long x, long long y, long long parentx, long long parenty,
           char c) {
  if (!isSafe(x, y, c)) {
    return;
  }
  if (mark[x][y]) {
    flag = true;
    return;
  }
  mark[x][y] = true;
  sz++;
  for (long long i = 0; i < 4; i++) {
    long long r = x + row[i];
    long long cc = y + col[i];
    if (r == parentx && cc == parenty) continue;
    check(r, cc, x, y, c);
  }
}
int main() {
  cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      if (!mark[i][j]) {
        check(i, j, -1, -1, a[i][j]);
        if (flag == 1 && sz >= 4) {
          cout << "Yes" << endl;
          return 0;
        }
        flag = 0;
        sz = 0;
      }
    }
  }
  cout << "No" << endl;
}
