#include <bits/stdc++.h>
using namespace std;
int ans = 0;
int m, n;
char g[50][50];
int v[50][50];
void dfs(int r, int c, int pr, int pc, int l) {
  v[r][c] = l;
  if (r > 0 && g[r - 1][c] == g[r][c]) {
    if (v[r - 1][c] != 0 && (!(r - 1 == pr && c == pc))) {
      if (v[r][c] - v[r - 1][c] >= 3) {
        ans = 1;
        return;
      }
    } else if (v[r - 1][c] == 0) {
      dfs(r - 1, c, r, c, l + 1);
    }
  }
  if (r < n - 1 && g[r + 1][c] == g[r][c]) {
    if (v[r + 1][c] != 0 && (!(r + 1 == pr && c == pc))) {
      if (v[r][c] - v[r + 1][c] >= 3) {
        ans = 1;
        return;
      }
    } else if (v[r + 1][c] == 0) {
      dfs(r + 1, c, r, c, l + 1);
    }
  }
  if (c > 0 && g[r][c - 1] == g[r][c]) {
    if (v[r][c - 1] != 0 && (!(r == pr && c - 1 == pc))) {
      if (v[r][c] - v[r][c - 1] >= 3) {
        ans = 1;
        return;
      }
    } else if (v[r][c - 1] == 0) {
      dfs(r, c - 1, r, c, l + 1);
    }
  }
  if (c < m - 1 && g[r][c + 1] == g[r][c]) {
    if (v[r][c + 1] != 0 && (!(r == pr && c + 1 == pc))) {
      if (v[r][c] - v[r][c + 1] >= 3) {
        ans = 1;
        return;
      }
    } else if (v[r][c + 1] == 0) {
      dfs(r, c + 1, r, c, l + 1);
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> g[i][j];
      v[i][j] = 0;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      for (int k = 0; k < n; k++) {
        for (int x = 0; x < m; x++) {
          v[k][x] = 0;
        }
      }
      v[i][j] = 1;
      dfs(i, j, -1, -1, 1);
      if (ans == 1) {
        goto exit;
      }
    }
  }
exit:
  if (ans == 1) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
