#include <bits/stdc++.h>
using namespace std;
const int LIM = 1e5;
const int INF = 1e9;
const long long INF64 = 1e18;
const int MOD = INF + 7;
const double EPS = 1e-9;
int n, m;
char c[100][100];
bool used[100][100];
void dfs(int x_, int y_, int pred) {
  used[x_][y_] = 1;
  if (pred != 2) {
    if (x_ + 1 < n)
      if (c[x_ + 1][y_] == c[x_][y_])
        if (!used[x_ + 1][y_])
          dfs(x_ + 1, y_, 1);
        else {
          cout << "Yes";
          exit(0);
        }
  } else
    ;
  if (pred != 1) {
    if (x_ - 1 >= 0)
      if (c[x_ - 1][y_] == c[x_][y_])
        if (!used[x_ - 1][y_])
          dfs(x_ - 1, y_, 2);
        else {
          cout << "Yes";
          exit(0);
        }
  } else
    ;
  if (pred != 4) {
    if (y_ + 1 < m)
      if (c[x_][y_ + 1] == c[x_][y_])
        if (!used[x_][y_ + 1])
          dfs(x_, y_ + 1, 3);
        else {
          cout << "Yes";
          exit(0);
        }
  } else
    ;
  if (pred != 3) {
    if (y_ - 1 < m)
      if (c[x_][y_ - 1] == c[x_][y_])
        if (!used[x_][y_ - 1])
          dfs(x_, y_ - 1, 4);
        else {
          cout << "Yes";
          exit(0);
        }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> c[i][j];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (!used[i][j]) dfs(i, j, -1);
  cout << "No";
  return 0;
}
