#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100;
const int tx[4] = {0, 0, 1, -1};
const int ty[4] = {1, -1, 0, 0};
int n, m;
int a[MAXN][MAXN];
bool us[MAXN][MAXN];
void dfs(int x, int y, int prx, int pry) {
  us[x][y] = true;
  for (int i = 0; i < 4; i++) {
    int tox = x + tx[i], toy = y + ty[i];
    if ((tox != prx || toy != pry) && a[x][y] == a[tox][toy]) {
      if (!us[tox][toy]) {
        dfs(tox, toy, x, y);
      } else {
        cout << "Yes";
        exit(0);
      }
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < m; j++) a[i][j + 1] = int(s[j]);
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (!us[i][j]) dfs(i, j, 0, 0);
  cout << "No";
}
