#include <bits/stdc++.h>
using namespace std;
int grid[55][55];
int R, C;
int state[55][55];
map<pair<int, int>, pair<int, int> > parent;
string ans;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
void dfs(int r, int c) {
  if (ans == "Yes") return;
  state[r][c] = 1;
  for (int d = 0; d < 4; d++) {
    int nr = r + dr[d];
    int nc = c + dc[d];
    if (nr < 0 || nr >= R || nc < 0 || nc >= C) continue;
    if (grid[nr][nc] != grid[r][c]) continue;
    if (state[nr][nc] == 0) {
      parent[pair<int, int>(nr, nc)] = pair<int, int>(r, c);
      dfs(nr, nc);
    } else if (state[nr][nc] == 1 &&
               parent[pair<int, int>(r, c)] != pair<int, int>(nr, nc)) {
      int lenCycle = 0;
      for (pair<int, int> curr = pair<int, int>(nr, nc);
           curr != pair<int, int>(-1, -1); curr = parent[curr])
        lenCycle++;
      if (lenCycle >= 4) ans = "Yes";
    }
  }
}
int main() {
  cin >> R >> C;
  for (int r = 0; r < R; r++) {
    string tmp;
    cin >> tmp;
    for (int c = 0; c < C; c++) {
      grid[r][c] = tmp[c];
      state[r][c] = 0;
    }
  }
  parent.clear();
  ans = "No";
  for (int r = 0; r < R; r++)
    for (int c = 0; c < C; c++)
      if (state[r][c] == 0) {
        parent[pair<int, int>(r, c)] = pair<int, int>(-1, -1);
        dfs(r, c);
      }
  cout << ans << endl;
  return 0;
}
