#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const long long mod = 1e9 + 7;
const int oo = 1e9;
char mat[300][300];
int n, m;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i <= n - 1; i++)
    for (int j = 0; j <= m - 1; j++) cin >> mat[i][j];
  for (int i = 0; i <= n - 2; i++)
    for (int j = 0; j <= m - 2; j++) {
      if (mat[i][j] == mat[i][j + 1] || mat[i][j] == mat[i + 1][j]) {
        cout << "Yes";
        return 0;
      }
    }
  cout << "No";
}
