#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
char a[55][55];
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int vis[55][55];
int n, m;
bool valid(int i, int j) { return i >= 0 && i < n && j >= 0 && j < m ? 1 : 0; }
void dfs(int x, int y, int k, int pax, int pay) {
  vis[x][y] = 1;
  for (long long i = 0; i < 4; i++) {
    int x1 = x + dx[i];
    int y1 = y + dy[i];
    if (valid(x1, y1)) {
      if (a[x1][y1] != a[x][y]) continue;
      if (!vis[x1][y1]) {
        k++;
        dfs(x1, y1, k, x, y);
        k--;
      } else if ((x1 != pax && y1 != pay)) {
        cout << "Yes";
        exit(0);
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int i;
  cin >> n >> m;
  for (long long i = 0; i < 55; i++) memset(vis[i], 0, sizeof(vis[i]));
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) {
      if (!vis[i][j]) dfs(i, j, 0, -1, -1);
    }
  cout << "No";
}
