#include <bits/stdc++.h>
using namespace std;
char a[50][50];
long long int vis[50][50];
long long int n, m;
bool dfs(long long int i, long long int j, long long int pi, long long int pj) {
  long long int u[] = {1, -1, 0, 0};
  long long int v[] = {0, 0, 1, -1};
  vis[i][j] = 1;
  for (long long int k = 0; k < 4; k++) {
    long long int x = i + u[k];
    long long int y = j + v[k];
    if (x < 0 || y < 0 || x >= n || y >= m || (a[i][j] != a[x][y])) continue;
    if (vis[x][y] == 0) {
      if (dfs(x, y, i, j) == true) {
        return true;
      }
    } else if (x != pi && y != pj)
      return true;
  }
  return false;
}
int main() {
  memset(vis, 0, sizeof(vis));
  cin >> n >> m;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) cin >> a[i][j];
  }
  long long int ch = 0;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      if (vis[i][j] == 0 && dfs(i, j, -1, -1)) {
        ch = 1;
        break;
      }
    }
    if (ch == 1) break;
  }
  if (ch == 1)
    cout << "Yes\n";
  else
    cout << "No\n";
}
