#include <bits/stdc++.h>
using namespace std;
char a[51][51];
long long vis[51][51];
long long n, m, k, x[4] = {1, -1, 0, 0}, y[4] = {0, 0, 1, -1};
long long dfs(long long i, long long j, long long k) {
  if (i < 0 || j < 0 || i >= n || j >= m || (vis[i][j] and k - vis[i][j] < 3))
    return 0;
  if (vis[i][j]) return 1;
  vis[i][j] = k;
  for (long long l = 0; l < 4; l++) {
    long long ni = i + x[l], nj = j + y[l];
    if (ni >= 0 and ni < n and nj >= 0 and nj < m)
      if (a[ni][nj] == a[i][j] and dfs(ni, nj, k + 1)) return 1;
  }
  a[i][j] = '*';
  return 0;
}
void solve() {
  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 (!vis[i][j] and dfs(i, j, k)) {
        cout << "Yes\n";
        return;
      } else
        k = 1;
  cout << "No\n";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  cerr << "[Execution : " << (1.0 * clock()) / CLOCKS_PER_SEC << "s]\n";
  return 0;
}
