#include <bits/stdc++.h>
using namespace std;
const int INF = 2000000000;
const int MAX = 10000000;
int n, m;
vector<string> g;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
int vis[55][55];
bool val = false;
void dfs(int r, int c, int pr, int pc, int cnt) {
  vis[r][c] = 1;
  for (int i = 0; i < 4; i++) {
    int x = r + dx[i], y = c + dy[i];
    if (x >= 0 && x < n && y >= 0 && y < m && g[x][y] == g[r][c] &&
        (x != pr || y != pc)) {
      if (!vis[x][y])
        dfs(x, y, r, c, cnt + 1);
      else if (cnt >= 4) {
        val = true;
        return;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  g.resize(n);
  for (int i = 0; i < n; i++) cin >> g[i];
  val = false;
  memset(vis, 0, sizeof vis);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      dfs(i, j, -1, -1, 1);
      if (val) {
        cout << "Yes\n";
        return 0;
      }
    }
  }
  cout << "No\n";
  return 0;
}
