#include <bits/stdc++.h>
using namespace std;
int visited[55][55];
int cnt[55][55];
int n, m;
vector<string> M;
bool ans = false;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
bool found = false;
void dfs(int y, int x, char l) {
  if (found) return;
  for (int k = 0; k < 4; ++k) {
    auto ny = y + dy[k];
    auto nx = x + dx[k];
    if (nx < 0 || ny < 0 || nx >= m || ny >= n || M[ny][nx] != l) continue;
    if (visited[ny][nx] == 0) {
      visited[ny][nx] = 1;
      dfs(ny, nx, l);
    } else if (visited[ny][nx] == -1) {
      found = true;
      return;
    }
  }
}
int main(int argc, char* argv[]) {
  cin >> n >> m;
  M.resize(n);
  for (auto& s : M) cin >> s;
  for (int i = 0; i < n && !ans; ++i)
    for (int j = 0; j < m && !ans; ++j) {
      for (int k = 0; k < n; ++k)
        for (int l = 0; l < m; ++l) visited[k][l] = 0;
      visited[i][j] = 1;
      for (int k = 0; k < 4; ++k) {
        auto ny = i + dy[k];
        auto nx = j + dx[k];
        if (nx < 0 || ny < 0 || nx >= m || ny >= n || M[ny][nx] != M[i][j])
          continue;
        visited[ny][nx] = -1;
      }
      for (int k = 0; k < 4; ++k) {
        auto ny = i + dy[k];
        auto nx = j + dx[k];
        if (nx < 0 || ny < 0 || nx >= m || ny >= n || M[ny][nx] != M[i][j])
          continue;
        visited[ny][nx] = 1;
        dfs(ny, nx, M[i][j]);
        visited[ny][nx] = -1;
        if (found) {
          cout << "Yes\n";
          return 0;
        }
      }
    }
  cout << "No\n";
  return 0;
}
