#include <bits/stdc++.h> using namespace std; char a[110][110]; int n, m; bool vis[110][110]; int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; bool found = false; // 标记是否找到路径 void dfs(int x, int y) { if (x == n && y == m) { // 到达终点 found = true; return; } for (int i = 0; i < 4; i++) { int nx = x + dx[i]; int ny = y + dy[i]; if (nx < 1 || nx > n || ny < 1 || ny > m) continue; if (a[nx][ny] == '#') continue; if (!vis[nx][ny]) { vis[nx][ny] = 1; dfs(nx, ny); if (found) return; // 找到路径后提前退出 } } } int main() { cin >> n >> m; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >> a[i][j]; } } vis[1][1] = 1; dfs(1, 1); cout << (found ? "Yes" : "No") << endl; return 0; }