#include <bits/stdc++.h>
using namespace std;
const int MAX = 101;
int n, m;
char arr[MAX][MAX];
int vis[MAX][MAX];
bool ans;
void dfs(int x, int y, int px, int py) {
  if (vis[x][y] == 1) ans = true;
  if (vis[x][y]) return;
  vis[x][y] = 1;
  if (x > 0 && arr[x - 1][y] == arr[x][y] && (x - 1 != px || y != py))
    dfs(x - 1, y, x, y);
  if (x < n && arr[x + 1][y] == arr[x][y] && (x + 1 != px || y != py))
    dfs(x + 1, y, x, y);
  if (y > 0 && arr[x][y - 1] == arr[x][y] && (x != px || y - 1 != py))
    dfs(x, y - 1, x, y);
  if (y < m && arr[x][y + 1] == arr[x][y] && (x != px || y + 1 != py))
    dfs(x, y + 1, x, y);
  vis[x][y] = 2;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) cin >> arr[i][j];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j)
      if (!vis[i][j] && !ans) dfs(i, j, -1, -1);
  if (ans)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
