#include <bits/stdc++.h>
using namespace std;
int n, m, d = 0, ok[100][100];
char b;
char a[100][100];
void DFS(int x, int y, int n, int m) {
  ok[x][y] = 1;
  if (a[x][y - 1] == b && (n != x || y - 1 != m))
    if (!ok[x][y - 1])
      DFS(x, y - 1, x, y);
    else
      d = 1;
  if (a[x][y + 1] == b && (n != x || y + 1 != m))
    if (!ok[x][y + 1])
      DFS(x, y + 1, x, y);
    else
      d = 1;
  if (a[x + 1][y] == b && (n != x + 1 || y != m))
    if (!ok[x + 1][y])
      DFS(x + 1, y, x, y);
    else
      d = 1;
  if (a[x - 1][y] == b && (n != x - 1 || y != m))
    if (!ok[x - 1][y])
      DFS(x - 1, y, x, y);
    else
      d = 1;
  if (d == 1) return;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> a[i][j];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      if (ok[i][j] == 0) {
        b = a[i][j];
        DFS(i, j, -1, -1);
        if (d == 1) {
          cout << "Yes";
          return 0;
        }
      }
    }
  cout << "No";
}
