#include <bits/stdc++.h>
using namespace std;
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
int n, m;
bool valid(int r1, int c1) { return r1 > -1 && r1 < n && c1 > -1 && c1 < m; }
char ar[100][100];
bool vis[100][100];
bool ans = 0;
void dfs(int r, int c, int pr, int pc) {
  if (vis[r][c]) {
    ans = 1;
    return;
  }
  vis[r][c] = 1;
  for (int i = 0; i < 4; i++) {
    int u, v;
    u = r + dx[i];
    v = c + dy[i];
    if (valid(u, v) && (u != pr || v != pc) && ar[u][v] == ar[r][c])
      dfs(u, v, r, c);
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> ar[i][j];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (!vis[i][j]) {
        dfs(i, j, -1, -1);
        if (ans) {
          cout << "Yes";
          return 0;
        }
      }
  cout << "No";
  return 0;
}
