#include <bits/stdc++.h>
using namespace std;
void reset(int** r, int n, int m) {
  int i, j;
  int* tmp;
  for (i = 0; i < n; i++) {
    memset(r[i], 0, sizeof(int) * m);
  }
}
int dfs(int x, int y, int i, int j, char** G, int** record, int n, int m,
        int level) {
  if ((x >= n) || (x < 0) || (y >= m) || (y < 0)) {
    return 0;
  }
  char c = G[i][j];
  if (c != G[x][y])
    return 0;
  else if (x == i && y == j && level >= 3)
    return 1;
  else if (record[x][y] == 1)
    return 0;
  else {
    record[x][y] = 1;
    return dfs(x - 1, y, i, j, G, record, n, m, level + 1) ||
           dfs(x, y - 1, i, j, G, record, n, m, level + 1) ||
           dfs(x + 1, y, i, j, G, record, n, m, level + 1) ||
           dfs(x, y + 1, i, j, G, record, n, m, level + 1);
  }
}
int main() {
  int n, m, i, j, k, flag = 0;
  cin >> n >> m;
  char** G;
  int** record;
  G = new char*[n];
  record = new int*[n];
  for (i = 0; i < n; i++) {
    G[i] = new char[m];
    record[i] = new int[m];
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> G[i][j];
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      reset(record, n, m);
      flag = dfs(i, j, i, j, G, record, n, m, 0);
      if (flag) goto label;
    }
  }
label:
  if (flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
