#include <bits/stdc++.h>
using namespace std;
struct debugger {
  template <typename T>
  debugger &operator,(const T &v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
vector<int> d = {0, 1, 0, -1, 0};
bool dfs(vector<vector<char>> &board, vector<vector<int>> &state, int r, int c,
         int pr, int pc, int &cnt) {
  state[r][c] = 1;
  ++cnt;
  int x, y;
  for (int i = 0; i < 4; ++i) {
    x = r + d[i], y = c + d[i + 1];
    if (0 > x || x >= board.size() || 0 > y || y >= board[0].size() ||
        board[x][y] != board[r][c] || (x == pr && y == pc))
      continue;
    if (state[x][y] == 0) {
      if (dfs(board, state, x, y, r, c, cnt)) return true;
    } else if (state[x][y] == 1)
      return true;
  }
  state[r][c] = 2;
  --cnt;
  return false;
}
int main() {
  int n, m;
  bool res = false;
  cin >> n >> m;
  vector<vector<char>> board(n, vector<char>(m));
  vector<vector<int>> state(n, vector<int>(m));
  for (int r = 0; r < n; ++r) {
    for (int c = 0; c < m; ++c) {
      cin >> board[r][c];
    }
  }
  for (int r = 0; r < n; ++r) {
    for (int c = 0; c < m; ++c) {
      if (state[r][c] == 0) {
        int cnt = 0;
        if (dfs(board, state, r, c, -1, -1, cnt)) {
          if (cnt >= 4) {
            res = true;
            break;
          }
        }
      }
    }
  }
  if (res)
    puts("Yes");
  else
    puts("No");
}
