#include
using namespace std;
const int maxn = 100;
int n, m;
int map[maxn][maxn], vis[maxn][maxn];
int startx, starty, endx, endy;
int dir[4][2] = {-1, 0, 0, 1, 1, 0, 0, -1};
bool law(int x, int y) {
if (x >= 0 && x < n && y >= 0 && y < m
&& map[x][y] == 0 && vis[x][y] == 0)
return 1;
return 0;
}
bool DFS(int x, int y) {
if (x == endx && y == endy)
return 1;
vis[x][y] = 1;
for (int i = 0; i < 4; ++i) {
int nx = x + dir[i][0];
int ny = y + dir[i][1];
if (law(nx, ny))
if (DFS(nx, ny))
return 1;
}
return 0;
}
int main() {
while (scanf(“%d %d”, &n, &m) != EOF) {
char convert[maxn];
memset(vis,0,sizeof(vis));
for (int i = 0; i < n; ++i){
scanf(“%s”,&convert);
for (int j = 0; j < m; ++j)
map[i][j]=(convert[j]==’.’)?0:1;}
startx=0;starty=0;endx=n-1;endy=m-1;
if (DFS(startx, starty))
printf(“YES\n”);
else
printf(“NO\n”);
}
return 0;
}