#include<bits/stdc++.h>
using namespace std;
int fx[] {0,1,-1,0};
int fy[] {1,0,0,-1};
char g[45][45];
bool vis[45][45],f;
int n,m;
bool notin(int x,int y) {
return x<1||x>n||y<1||y>m;
}
void goout(int x,int y) {
if(xn&&ym) {
f=true;
return ;
}
for(int i=0; i<4; i++) {
int nx=x+fx[i],ny=y+fy[i];
if(notin(nx,ny)||g[nx][ny]=='#'||vis[nx][ny]) continue;
vis[nx][ny]=true;
goout(nx,ny);
if(f) return;
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>m;
for(int i=1; i<=n; i++) {
for(int j=1; j<=m; j++) {
cin>>g[i][j];
}
}
vis[1][1]=true;
goout(1,1);
if(f) cout<<"YES";
else cout<<"NO";
return 0;
}