#include <bits/stdc++.h>
int col[4] = {1, 0, -1, 0};
int row[4] = {0, 1, 0, -1};
using namespace std;
bool vis[55][55];
string gd[55];
int n, m;
void dfs(int a, int b, int p, int q) {
  vis[a][b] = true;
  for (int i = 0; i < 4; i++) {
    int x, y;
    x = a + row[i];
    y = b + col[i];
    if (make_pair(x, y) == make_pair(p, q)) continue;
    if (0 <= x && x < n && 0 <= y && y < m && gd[a][b] == gd[x][y]) {
      if (!vis[x][y]) {
        dfs(x, y, a, b);
      } else {
        cout << "Yes" << endl;
        exit(0);
      }
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> gd[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (!vis[i][j]) dfs(i, j, -1, -1);
  cout << "No" << endl;
  return 0;
}
