#include <bits/stdc++.h>
using namespace std;
const int N = 150;
const long long M = 1e9 + 7;
char g[N][N];
bool vis[N][N];
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, -1, 1};
int n, m;
bool valid(int x, int y) { return x >= 0 && y >= 0 && x < n && y < m; }
void dfs(int i, int j, char c, int px, int py) {
  vis[i][j] = 1;
  for (int k = 0; k < 4; k++) {
    int xd = dx[k] + i;
    int yd = dy[k] + j;
    if (xd == px && py == yd) continue;
    if (valid(xd, yd) && g[xd][yd] == c) {
      if (vis[xd][yd]) {
        puts("Yes");
        exit(0);
      } else {
        dfs(xd, yd, g[xd][yd], i, j);
      }
    }
  }
}
void solve() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%s", &g[i]);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (!vis[i][j]) dfs(i, j, g[i][j], -1, -1);
    }
  }
  puts("No");
}
int main() {
  int t = 1;
  while (t--) solve();
}
