#include <bits/stdc++.h>
using namespace std;
string a[50];
int n, m;
bool bf(int i, int j, int x, int y) {
  bool t = 0;
  int mx = max(i, x), my = max(j, y);
  for (int k = min(i, x); k <= mx; k++) {
    if (a[i][j] != a[k][j] || a[i][j] != a[mx + min(i, x) - k][my]) {
      t = 1;
      break;
    }
  }
  for (int k = min(j, y); k <= my; k++) {
    if (a[i][j] != a[i][k] || a[i][j] != a[mx][my + min(j, y) - k]) {
      t = 1;
      break;
    }
  }
  return !t;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int i, j, x, y;
  bool t = 0;
  cin >> n >> m;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      for (x = i + 1; x < n; x++) {
        for (y = 0; y < m; y++) {
          if (y != j && a[i][j] == a[x][y]) t = bf(i, j, x, y);
          if (t) break;
        }
        if (t) break;
      }
      if (t) break;
    }
    if (t) break;
  }
  t ? cout << "Yes" : cout << "No";
  return 0;
}
