#include <bits/stdc++.h>
using namespace std;
constexpr int dx[4] = {-1, 0, 0, 1};
constexpr int dy[4] = {0, -1, 1, 0};
int main() {
  int H, W;
  cin >> H >> W;
  vector<string> vec(H);
  for (int i = 0; i < H; ++i) {
    cin >> vec[i];
  }
  bool check = false;
  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      for (int k = 0; k < 4; ++k) {
        int ny = i + dy[k];
        int nx = j + dx[k];
        if (0 <= nx && nx < W && 0 <= ny && ny < H &&
            vec[i][j] == vec[ny][nx]) {
          check = true;
          break;
        }
      }
    }
  }
  cout << (check ? "Yes" : "No") << endl;
}
