#include <bits/stdc++.h>
using namespace std;
const double PI = M_PI;
const int INF = 1 * 1e9;
const long long limit = 1 * 1e16;
const int MOD1 = 1e9 + 711;
const int MOD2 = 1e9 + 933;
const int MOD3 = 1e9 + 993;
const int maxn = 1e6 + 100;
int n, m, I, J;
void dfs(vector<vector<char>> &a, vector<vector<bool>> &used, int i, int j,
         int cnt) {
  if (i > 1 && a[i - 1][j] == a[i][j]) {
    if (!used[i - 1][j]) {
      used[i - 1][j] = true;
      dfs(a, used, i - 1, j, cnt + 1);
    } else {
      if ((i - 1 == I) && j == J && cnt >= 4) {
        cout << "Yes";
        exit(0);
      }
    }
  }
  if (j > 1 && a[i][j - 1] == a[i][j]) {
    if (!used[i][j - 1]) {
      used[i][j - 1] = true;
      dfs(a, used, i, j - 1, cnt + 1);
    } else {
      if (i == I && (j - 1 == J) && cnt >= 4) {
        cout << "Yes";
        exit(0);
      }
    }
  }
  if (i < n && a[i + 1][j] == a[i][j]) {
    if (!used[i + 1][j]) {
      used[i + 1][j] = true;
      dfs(a, used, i + 1, j, cnt + 1);
    } else {
      if ((i + 1 == I) && j == J && cnt >= 4) {
        cout << "Yes";
        exit(0);
      }
    }
  }
  if (j < m && a[i][j + 1] == a[i][j]) {
    if (!used[i][j + 1]) {
      used[i][j + 1] = true;
      dfs(a, used, i, j + 1, cnt + 1);
    } else {
      if (i == I && (j + 1 == J) && cnt >= 4) {
        cout << "Yes";
        exit(0);
      }
    }
  }
}
int main() {
  cout.tie(0);
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  vector<vector<char>> a(n + 1, vector<char>(m + 1));
  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) {
      vector<vector<bool>> used(n + 1, vector<bool>(m + 1));
      used[i][j] = true;
      I = i;
      J = j;
      dfs(a, used, i, j, 1);
    }
  }
  cout << "No";
  cerr << "\n\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
  return 0;
}
