#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, k, l, p;
string s;
char a[54][54];
bool mark[52][52], pal = false;
void dfs(int x, int y, int x1, int y1) {
  if (pal) return;
  mark[x][y] = true;
  if (a[x + 1][y] == a[x][y] && (x + 1 != x1 || y != y1)) {
    if (mark[x + 1][y])
      pal = true;
    else
      dfs(x + 1, y, x, y);
  }
  if (a[x][y + 1] == a[x][y] && (x != x1 || y + 1 != y1)) {
    if (mark[x][y + 1])
      pal = true;
    else
      dfs(x, y + 1, x, y);
  }
  if (a[x - 1][y] == a[x][y] && (x - 1 != x1 || y != y1)) {
    if (mark[x - 1][y])
      pal = true;
    else
      dfs(x - 1, y, x, y);
  }
  if (a[x][y - 1] == a[x][y] && (x != x1 || y - 1 != y1)) {
    if (mark[x][y - 1])
      pal = true;
    else
      dfs(x, y - 1, x, y);
  }
}
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    cin >> s;
    for (j = 1; j <= s.size(); j++) {
      a[i][j] = s[j - 1];
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      if (!mark[i][j]) dfs(i, j, -12, -12);
    }
  }
  if (pal)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
