#include <bits/stdc++.h>
using namespace std;
int n, m;
char a[50][50], ch[50][50];
int v[26];
int f(int b, int c, int i, int j) {
  if (ch[i][j] == '*' && a[b][c] == a[i][j]) {
    cout << "Yes";
    exit(0);
  } else
    ch[i][j] = '*';
  if (i + 1 != b && i + 1 < n && a[i + 1][j] == a[i][j]) f(i, j, i + 1, j);
  if (i - 1 != b && i - 1 >= 0 && a[i - 1][j] == a[i][j]) f(i, j, i - 1, j);
  if (j + 1 != c && j + 1 < m && a[i][j + 1] == a[i][j]) f(i, j, i, j + 1);
  if (j - 1 != c && i - 1 >= 0 && a[i][j - 1] == a[i][j]) f(i, j, i, j - 1);
}
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 (ch[i][j] == '*') continue;
      if (i + 1 < n && a[i + 1][j] == a[i][j]) f(i, j, i + 1, j);
      if (i - 1 >= 0 && a[i - 1][j] == a[i][j]) f(i, j, i - 1, j);
      if (j + 1 < m && a[i][j + 1] == a[i][j]) f(i, j, i, j + 1);
      if (i - 1 >= 0 && a[i][j - 1] == a[i][j]) f(i, j, i, j - 1);
    }
  cout << "No";
  return 0;
}
