#include <bits/stdc++.h>
using namespace std;
int n1, m1;
bool findCycle = false;
int vis[55][55] = {
    0,
};
int edge[55][55] = {
    0,
};
string board[55];
const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};
bool can(int x, int y) {
  if (x >= 0 && x < n1 && y >= 0 && y < m1) return true;
  return false;
}
int startRow = -1, startCol = -1;
void dfs(char c, int n, int m, int timer) {
  if (findCycle) return;
  vis[n][m] = 1;
  int nextRow, nextCol;
  for (int i = 0; i < 4; i++) {
    nextRow = n + dy[i];
    nextCol = m + dx[i];
    if (can(nextRow, nextCol)) {
      if (timer + 1 >= 4 && startRow == nextRow && startCol == nextCol) {
        findCycle = true;
        return;
      }
      if (!vis[nextRow][nextCol] && board[nextRow][nextCol] == c) {
        dfs(c, nextRow, nextCol, timer + 1);
      }
    }
  }
}
int main() {
  findCycle = false;
  cin >> n1 >> m1;
  for (int i = 0; i < n1; i++) cin >> board[i];
  for (int i = 0; i < n1; i++)
    for (int j = 0; j < m1; j++) {
      memset(vis, 0, sizeof(vis));
      if (!vis[i][j]) {
        startRow = i;
        startCol = j;
        dfs(board[i][j], i, j, 1);
      }
    }
  if (findCycle)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
