#include <bits/stdc++.h>
using namespace std;
char a[52][52];
int n, m, dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
bool vis[52][52];
void dfs(int x, int y, int lx, int ly) {
  vis[x][y] = 1;
  for (int i = 0; i < 4; i++) {
    int xx = x + dx[i], yy = y + dy[i];
    if (a[x][y] != a[xx][yy]) continue;
    if (xx == lx && yy == ly) continue;
    if (vis[xx][yy]) {
      cout << "Yes";
      exit(0);
    } else if (xx > 0 && xx <= n && yy > 0 && yy <= m)
      dfs(xx, yy, x, y);
  }
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int u = 1; u <= m; u++) cin >> a[i][u];
  for (int i = 1; i <= n; i++)
    for (int u = 1; u <= m; u++)
      if (!vis[i][u]) dfs(i, u, i, u);
  cout << "No";
  return 0;
}
