#include <bits/stdc++.h>
using namespace std;
ifstream in("in.txt");
int n, m;
char mp[100][101] = {' '};
bool used[101][101] = {0};
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
bool ans = 0;
bool valid(int x, int y) { return x >= 0 && x < n && y >= 0 && y < m; }
void dfs(pair<int, int> now, pair<int, int> last) {
  used[now.first][now.second] = 1;
  for (int i = 0; i < 4; i++) {
    if (valid(now.first + dx[i], now.second + dy[i]) &&
        mp[now.first + dx[i]][now.second + dy[i]] ==
            mp[now.first][now.second]) {
      if (!used[now.first + dx[i]][now.second + dy[i]]) {
        dfs(make_pair(now.first + dx[i], now.second + dy[i]), now);
      } else {
        if (make_pair(now.first + dx[i], now.second + dy[i]) != last) ans = 1;
      }
    }
  }
}
int main(int argc, char** argv) {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> mp[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (!used[i][j]) dfs({i, j}, {51, 51});
    }
  }
  if (ans)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
