#include <bits/stdc++.h>
using namespace std;
vector<string> v;
int dir1[] = {0, 0, 1, -1};
int dir2[] = {1, -1, 0, 0};
int ar[] = {1, 0, 3, 2, -1};
bool vis[100][100];
int r, c;
bool dfs(int x, int y, int dir) {
  if (vis[x][y]) return true;
  vis[x][y] = 1;
  for (int i = 0; i < 4; i++)
    if (ar[dir] != i && x + dir1[i] < r && y + dir2[i] < c &&
        y + dir2[i] >= 0 && x + dir1[i] >= 0 &&
        (v[x][y] == v[x + dir1[i]][y + dir2[i]]))
      return dfs(x + dir1[i], y + dir2[i], i);
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> r >> c;
  for (int i = 0; i < r; i++) {
    string second;
    cin >> second;
    v.push_back(second);
  }
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      memset(vis, 0, sizeof(vis));
      if (!vis[i][j]) {
        if (dfs(i, j, 4)) {
          cout << "Yes\n";
          goto ss;
        }
      }
    }
  }
  cout << "No\n";
ss:
  return 0;
}
