#include <bits/stdc++.h>
using namespace std;
int main() {
  map<char, list<pair<int, int> > > mtp;
  stack<pair<pair<int, int>, int> > st;
  pair<int, int> p;
  pair<pair<int, int>, int> rt;
  map<char, list<pair<int, int> > >::iterator mt;
  list<pair<int, int> >::iterator lt;
  int n, m;
  char x;
  bool flag = false;
  cin >> n >> m;
  char **dot = new char *[n];
  bool **vst = new bool *[n];
  for (int i = 0; i < n; i++) {
    vst[i] = new bool[m];
    dot[i] = new char[m];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) vst[i][j] = false;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; ++j) {
      cin >> x;
      dot[i][j] = x;
      mtp[x].push_back(make_pair(i, j));
    }
  }
  for (mt = mtp.begin(); mt != mtp.end(); mt++) {
    if (mt->second.size() >= 4) {
      lt = mt->second.begin();
      while (lt != mt->second.end()) {
        if (!vst[(*lt).first][(*lt).second]) st.push(make_pair(*lt, 0));
        while (!st.empty()) {
          rt = st.top();
          st.pop();
          p = rt.first;
          if (!vst[p.first][p.second])
            vst[p.first][p.second] = true;
          else {
            cout << "Yes" << endl;
            flag = true;
            break;
          }
          if (rt.second == 0) {
            if (p.first + 1 < n &&
                (dot[p.first][p.second] == dot[p.first + 1][p.second]))
              st.push(make_pair(make_pair(p.first + 1, p.second), 2));
            if (p.second + 1 < m &&
                (dot[p.first][p.second] == dot[p.first][p.second + 1]))
              st.push(make_pair(make_pair(p.first, p.second + 1), 1));
          }
          if (rt.second == 1) {
            if (p.first + 1 < n &&
                (dot[p.first][p.second] == dot[p.first + 1][p.second]))
              st.push(make_pair(make_pair(p.first + 1, p.second), 2));
            if (p.second + 1 < m &&
                (dot[p.first][p.second] == dot[p.first][p.second + 1]))
              st.push(make_pair(make_pair(p.first, p.second + 1), 1));
            if (p.first - 1 >= 0 &&
                (dot[p.first][p.second] == dot[p.first - 1][p.second]))
              st.push(make_pair(make_pair(p.first - 1, p.second), 4));
          }
          if (rt.second == 2) {
            if (p.first + 1 < n &&
                (dot[p.first][p.second] == dot[p.first + 1][p.second]))
              st.push(make_pair(make_pair(p.first + 1, p.second), 2));
            if (p.second + 1 < m &&
                (dot[p.first][p.second] == dot[p.first][p.second + 1]))
              st.push(make_pair(make_pair(p.first, p.second + 1), 1));
            if (p.second - 1 >= 0 &&
                (dot[p.first][p.second] == dot[p.first][p.second - 1]))
              st.push(make_pair(make_pair(p.first, p.second - 1), 3));
          }
          if (rt.second == 3) {
            if (p.second - 1 >= 0 &&
                (dot[p.first][p.second] == dot[p.first][p.second - 1]))
              st.push(make_pair(make_pair(p.first, p.second - 1), 3));
            if (p.first - 1 >= 0 &&
                (dot[p.first][p.second] == dot[p.first - 1][p.second]))
              st.push(make_pair(make_pair(p.first - 1, p.second), 4));
            if (p.first + 1 < n &&
                (dot[p.first][p.second] == dot[p.first + 1][p.second]))
              st.push(make_pair(make_pair(p.first + 1, p.second), 2));
          }
          if (rt.second == 4) {
            if (p.second + 1 < m &&
                (dot[p.first][p.second] == dot[p.first][p.second + 1]))
              st.push(make_pair(make_pair(p.first, p.second + 1), 1));
            if (p.second - 1 >= 0 &&
                (dot[p.first][p.second] == dot[p.first][p.second - 1]))
              st.push(make_pair(make_pair(p.first, p.second - 1), 3));
            if (p.first - 1 >= 0 &&
                (dot[p.first][p.second] == dot[p.first - 1][p.second]))
              st.push(make_pair(make_pair(p.first - 1, p.second), 4));
          }
        }
        if (flag) break;
        ++lt;
      }
    }
    if (flag) break;
  }
  if (!flag) cout << "No" << endl;
  return 0;
}
