#include <bits/stdc++.h>
using namespace std;
vector<string> v;
int dir1[] = {1, 0, -1, 0};
int dir2[] = {0, 1, 0, -1};
int ar[] = {2, 3, 0, 1, -1};
bool vis[100][100];
int r, c;
bool valid(int x, int y, int i) {
  int X = x + dir1[i], Y = y + dir2[i];
  return (X >= 0) && (X < r) && (Y >= 0) && (Y < c) && v[x][y] == v[X][Y];
}
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 && valid(x, y, 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] && dfs(i, j, 4)) {
        cout << "Yes\n";
        goto ss;
      }
    }
  cout << "No\n";
ss:
  return 0;
}
