#include <bits/stdc++.h>
using namespace std;
bool dfs(int v, int c, vector<vector<int>>& g, vector<int>& color) {
  if (c - color[v] > 2) return true;
  if (c - color[v] == 2) return false;
  color[v] = c;
  for (auto u : g[v])
    if (dfs(u, c + 1, g, color)) return true;
  return false;
}
bool solve() {
  const int INF = 1e9;
  int n, m;
  scanf("%d%d", &n, &m);
  vector<vector<char>> a(n + 1, vector<char>(m + 1));
  vector<vector<int>> g(n * m);
  vector<int> color(n * m, INF);
  for (int i = 0; i < n; ++i) {
    scanf("\n");
    for (int j = 0; j < m; ++j) scanf("%c", &a[i][j]);
  }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      if (a[i][j] == a[i][j + 1]) {
        g[m * i + j].push_back(m * i + j + 1);
        g[m * i + j + 1].push_back(m * i + j);
      }
      if (a[i][j] == a[i + 1][j]) {
        g[m * i + j].push_back(m * (i + 1) + j);
        g[m * (i + 1) + j].push_back(m * i + j);
      }
    }
  for (int i = 0; i < n * m; ++i)
    if (color[i] == INF && dfs(i, 0, g, color)) return true;
  return false;
}
int main() {
  if (solve())
    printf("Yes");
  else
    printf("No");
  return 0;
}
