#include <bits/stdc++.h>
using namespace std;
int n, m;
string a[100];
int c[100][100];
int g(int u, int v) {
  if (u < 0) return -1;
  if (u >= n) return -1;
  if (v < 0) return -1;
  if (v >= m) return -1;
  return a[u][v];
}
bool dfs(int u, int v, int s) {
  if (c[u][v] == -1) return false;
  if (c[u][v] == 0) c[u][v] = -1;
  if (c[u][v] == 1)
    if (s >= 5)
      return true;
    else if (s != 1)
      return false;
  if (g(u - 1, v) == g(u, v))
    if (dfs(u - 1, v, s + 1)) return true;
  if (g(u + 1, v) == g(u, v))
    if (dfs(u + 1, v, s + 1)) return true;
  if (g(u, v - 1) == g(u, v))
    if (dfs(u, v - 1, s + 1)) return true;
  if (g(u, v + 1) == g(u, v))
    if (dfs(u, v + 1, s + 1)) return true;
  return false;
}
int main() {
  while (cin >> n >> m) {
    for (int i = 0; i < n; ++i) cin >> a[i];
    bool ans = false;
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < m; ++j) {
        if (ans) break;
        memset(c, 0, sizeof(c));
        c[i][j] = 1;
        if (dfs(i, j, 1)) ans = true;
      }
    if (ans)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
