#include <bits/stdc++.h>
using namespace std;
int n, m;
char maze[60][60];
int visited[60][60];
int mi[] = {0, 0, 1, -1};
int mj[] = {1, -1, 0, 0};
bool dfs(int i, int j, int k, char c) {
  if (visited[i][j] == 2 && k >= 4) return true;
  if (visited[i][j] == 2 && k < 4 && k > 0) return false;
  if (i < 0 || j < 0 || i >= n || j >= m || visited[i][j] == 1 ||
      maze[i][j] != c)
    return false;
  if (visited[i][j] != 2) visited[i][j] = 1;
  bool flag = false;
  for (int z = 0; z < 4; z++) flag = flag | dfs(i + mi[z], j + mj[z], k + 1, c);
  return flag;
}
void printt() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cout << visited[i][j];
    cout << endl;
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> maze[i][j];
  memset(visited, 0, sizeof visited);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      memset(visited, 0, sizeof visited);
      visited[i][j] = 2;
      if (dfs(i, j, 0, maze[i][j])) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  cout << "No" << endl;
  return 0;
}
