#include <bits/stdc++.h>
using namespace std;
const int OO = (int)2e9;
const long long oo = 5e18;
const int M = 1e5 + 50;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
int n, m;
char a[50][50];
int vs[50][50];
bool dfs(int x, int y, char c, int t) {
  if (a[x][y] != c || x < 0 || x >= n || y < 0 || y >= m ||
      (t - vs[x][y] > 0 && t - vs[x][y] < 4 && vs[x][y] != 0))
    return 0;
  if (a[x][y] == c && t - vs[x][y] >= 4 && vs[x][y] != 0) return 1;
  vs[x][y] = t;
  return (dfs(x - 1, y, c, t + 1) || dfs(x + 1, y, c, t + 1) ||
          dfs(x, y - 1, c, t + 1) || dfs(x, y + 1, c, t + 1));
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cin >> a[i][j];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) vs[i][j] = 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (!vs[i][j]) {
        if (dfs(i, j, a[i][j], 1)) {
          cout << "Yes";
          return 0;
        }
      }
    }
  }
  cout << "No";
}
