#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
const int mod = 1e9 + 7;
void ggg() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int vis[55][55];
char v[55][55];
int n, m, ans = 0, x, y;
bool cycle = false;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
void dfs(int r, int c, char ch, int a, int b) {
  vis[r][c] = 1;
  for (int i = 0; i < 4; i++) {
    x = r + dx[i];
    y = c + dy[i];
    if (x < 0 || y < 0 || x >= n || y >= m) continue;
    if (v[x][y] == ch && vis[x][y] && (x != a || y != b)) {
      cycle = true;
      return;
    } else if (v[x][y] == ch && !vis[x][y]) {
      dfs(x, y, ch, r, c);
    }
  }
}
int main() {
  ggg();
  cin >> n >> m;
  int i, j;
  for (i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> v[i][j];
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (!vis[i][j]) {
        dfs(i, j, v[i][j], i, j);
        if (cycle) return cout << "Yes", 0;
      }
    }
  }
  cout << "No" << '\n';
  return 0;
}
