#include <bits/stdc++.h>
using namespace std;
int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<char>> s(h, vector<char>(w));
  for (auto& e : s)
    for (auto& f : e) cin >> f;
  string ans = "No";
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if ((i + 1 < h && s[i][j] == s[i + 1][j]) ||
          (j + 1 < w && s[i][j] == s[i][j + 1]))
        ans = "Yes";
    }
  }
  cout << ans << endl;
}
