#include <bits/stdc++.h>
using namespace std;
string s[55];
long long n, m, nx[4] = {0, 0, 1, -1}, ny[4] = {1, -1, 0, 0};
bool z[55][55];
bool dfs(long long a, long long b, long long na, long long nb) {
  z[a][b] = true;
  for (long long i = 0; i < 4; i++) {
    long long ni = a + nx[i];
    long long nj = b + ny[i];
    if (ni < 0 || ni > n || nj < 0 || nj > m || s[a][b] != s[ni][nj] ||
        (ni == na && nj == nb))
      continue;
    if (z[ni][nj]) return true;
    if (dfs(ni, nj, a, b)) return true;
  }
  return false;
}
int main() {
  cin >> n >> m;
  for (long long i = 0; i < n; i++) cin >> s[i];
  bool w = true;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++)
      if (!z[i][j]) {
        if (dfs(i, j, i, j)) {
          cout << "Yes\n";
          w = false;
          break;
        }
      }
    if (!w) break;
  }
  if (w) cout << "No\n";
}
