#include <bits/stdc++.h>
using namespace std;
int dist[50][50];
int N, M;
bool visited[50][50];
char matrix[50][50];
char c;
bool isValid(int x, int y) {
  if (x < 0 || x > N - 1 || y < 0 || y > M - 1) return false;
  if (visited[x][y] == true) return false;
  return true;
}
bool isValid1(int x, int y) {
  if (x < 0 || x > N - 1 || y < 0 || y > M - 1) return false;
  if (matrix[x][y] != c) return false;
  return true;
}
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
bool bfs(int srcX, int srcY) {
  queue<pair<int, int>> q;
  q.push({srcX, srcY});
  map<pair<int, int>, pair<int, int>> parent;
  parent[{srcX, srcY}] = {-1, -1};
  visited[srcX][srcY] = 1;
  dist[srcX][srcY] = 0;
  bool done = false;
  while (!q.empty()) {
    int currX = q.front().first;
    int currY = q.front().second;
    q.pop();
    for (int i = 0; i < 4; i++) {
      if (isValid(currX + dx[i], currY + dy[i]) &&
          isValid1(currX + dx[i], currY + dy[i])) {
        int newX = currX + dx[i];
        int newY = currY + dy[i];
        q.push({newX, newY});
        visited[newX][newY] = true;
        dist[newX][newY] = dist[currX][currY] + 1;
        parent[{newX, newY}] = {currX, currY};
      } else if (!isValid(currX + dx[i], currY + dy[i]) &&
                 isValid1(currX + dx[i], currY + dy[i])) {
        if (!done) {
          int newX = currX + dx[i];
          int newY = currY + dy[i];
          if ((pair<int, int>(newX, newY) != parent[{currX, currY}]) &&
              (dist[newX][newY] + dist[currX][currY] + 1 >= 4))
            done = true;
        }
      }
    }
  }
  return done;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      cin >> matrix[i][j];
    }
  }
  bool done = false;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      if (!visited[i][j] && !done) {
        c = matrix[i][j];
        done = bfs(i, j);
      }
    }
  }
  if (done)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
