#include <bits/stdc++.h>
using namespace std;
const int MAXN = 60;
int n, m;
char a[MAXN][MAXN];
bool mark[MAXN][MAXN], mar[MAXN][MAXN];
pair<int, int> par[MAXN][MAXN];
vector<pair<int, int>> adj[MAXN][MAXN];
void dfs(int vf, int vs) {
  mark[vf][vs] = true;
  for (auto u : adj[vf][vs]) {
    if (mark[u.first][u.second]) {
      if (par[vf][vs] != u) {
        cout << "Yes" << endl;
        exit(0);
      }
    } else {
      par[u.first][u.second] = {vf, vs};
      dfs(u.first, u.second);
    }
  }
}
int main() {
  for (int i = 0; i < MAXN; i++)
    for (int j = 0; j < MAXN; j++) a[i][j] = '*';
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (a[i - 1][j] == a[i][j]) adj[i][j].push_back({i - 1, j});
      if (a[i + 1][j] == a[i][j]) adj[i][j].push_back({i + 1, j});
      if (a[i][j - 1] == a[i][j]) adj[i][j].push_back({i, j - 1});
      if (a[i][j + 1] == a[i][j]) adj[i][j].push_back({i, j + 1});
    }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (!mark[i][j]) dfs(i, j);
  cout << "No" << endl;
  return 0;
}
