#include <bits/stdc++.h>
using namespace std;
const long long int INF = 2e18;
long long int mod = 998244353;
bool isPrime(long long int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long int i = 5; i * i <= n; i = i + 6) {
    if (n % i == 0 || n % (i + 2) == 0) return false;
  }
  return true;
}
long long int fact(long long int n) {
  long long int ans = 1;
  for (long long int i = 1; i <= n; i++) ans = (ans * i) % 1000000007;
  return ans;
}
long long int exp(long long int x, long long int n) {
  long long int res = 1;
  while (n > 0) {
    if (n % 2 == 1) res = (res * x) % 1000000007;
    x = (x * x) % 1000000007;
    n = n / 2;
  }
  return res;
}
long long int nCr(long long int n, long long int k) {
  long long int res = 1;
  if (k > n - k) {
    k = n - k;
  }
  for (long long int i = 0; i < k; i++) {
    res *= (n - i);
    res /= (i + 1);
  }
  return res;
}
vector<vector<long long int>> dir = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
bool dfs(long long int x, long long int y, long long int parx,
         long long int pary, long long int &cnt, vector<vector<bool>> &vis,
         vector<string> &a, long long int n, long long int m) {
  vis[x][y] = true;
  cnt++;
  char c = a[x][y];
  for (int k = 0; k < 4; k++) {
    long long int xx = x + dir[k][0];
    long long int yy = y + dir[k][1];
    if (xx >= 0 and xx < n and yy >= 0 and yy < m and a[xx][yy] == c) {
      if (!vis[xx][yy]) {
        if (dfs(xx, yy, x, y, cnt, vis, a, n, m)) return true;
      } else if (xx != parx and yy != pary)
        return true;
    }
  }
  return false;
}
void null() {
  long long int n, m;
  cin >> n >> m;
  vector<string> a;
  for (long long int i = 0; i < n; i++) {
    string s;
    cin >> s;
    a.push_back(s);
  }
  vector<vector<bool>> vis(n, vector<bool>(m, false));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (!vis[i][j]) {
        long long int cnt = 0;
        if (dfs(i, j, -1, -1, cnt, vis, a, n, m) and cnt >= 4) {
          cout << "Yes" << '\n';
          return;
        }
      }
    }
  }
  cout << "No" << '\n';
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(9);
  cout << fixed;
  long long int t = 1;
  clock_t start, end;
  start = clock();
  while (t--) {
    null();
  }
  end = clock();
  double time_taken = double(end - start) / double(CLOCKS_PER_SEC);
}
