#include <bits/stdc++.h>
using namespace std;
vector<int> vi;
void seif() { std::ios_base::sync_with_stdio(0); }
int xaxis[] = {0, 1, -1, 0};
int yaxis[] = {1, 0, 0, -1};
int n, m;
char grid[55][55];
bool vis[55][55];
bool done = false;
bool valid(int x, int y) {
  if (x < 0 || y < 0 || x >= n || y >= m) return false;
  return true;
}
void dfs(int x, int y, int fromX, int fromY, char needColor) {
  if (!valid(x, y)) return;
  if (grid[x][y] != needColor) return;
  if (vis[x][y]) {
    done = 1;
    return;
  }
  vis[x][y] = true;
  for (int i = 0; i < 4; i++) {
    int nextX = x + xaxis[i];
    int nextY = y + yaxis[i];
    if (nextX == fromX && nextY == fromY) continue;
    dfs(nextX, nextY, x, y, needColor);
  }
}
int main() {
  seif();
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> grid[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      for (int i2 = 0; i2 < n; i2++) {
        for (int j2 = 0; j2 < m; j2++) vis[i2][j2] = false;
      }
      dfs(i, j, -1, -1, grid[i][j]);
      if (done) return cout << "Yes", 0;
    }
  }
  cout << "No";
  return 0;
}
