#include <bits/stdc++.h>
using namespace std;
int n, m;
char board[55][55];
bool vis[55][55];
void read_input() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> board[i][j];
    }
  }
}
bool in_board(int r, int c) {
  if (r < 0 or r >= n) return false;
  if (c < 0 or c >= m) return false;
  return true;
}
vector<int> diff{-1, 0, 1};
bool dfs(int R, int C, char character, int parR, int parC) {
  if (vis[R][C] == true) {
    return true;
  }
  vis[R][C] = true;
  bool res = false;
  for (int drow : diff) {
    for (int dcol : diff) {
      if (drow != 0 and dcol != 0) continue;
      if (drow == 0 and dcol == 0) continue;
      if (!in_board(R + drow, C + dcol)) continue;
      if (board[R + drow][C + dcol] != character) continue;
      if (R + drow == parR and C + dcol == parC) continue;
      res = (res or dfs(R + drow, C + dcol, character, R, C));
    }
  }
  return res;
}
int main() {
  read_input();
  bool res = false;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (vis[i][j] == false) res = (res or dfs(i, j, board[i][j], -1, -1));
    }
  }
  cout << (res ? "Yes" : "No") << endl;
}
