#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 9;
char grid[55][55];
bool vis[55][55];
int n, m;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
bool ok = 0;
bool valid(int r, int c) {
  if (r < 0 || r >= n || c < 0 || c >= m) return 0;
  return 1;
}
void dfs(int r, int c, int rr, int cc, char a) {
  if (!valid(r, c) || grid[r][c] != a) return;
  if (vis[r][c]) {
    ok = 1;
    return;
  }
  vis[r][c] = 1;
  for (int i = 0; i < 4; i++) {
    if (r + dx[i] == rr && c + dy[i] == cc) continue;
    dfs(r + dx[i], c + dy[i], r, c, a);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> grid[i][j];
  memset((vis), 0, sizeof(vis));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (!vis[i][j]) {
        dfs(i, j, -1, -1, grid[i][j]);
        if (ok) return cout << "Yes", 0;
      }
    }
  }
  cout << "No";
}
