#include using namespace std; #define REP(i, n) for(int(i)=0;(i)<(n);++(i)) int H,W,c; vector m; const int dir[][2] = {{1,0},{0,-1},{-1,0},{0,1}}; bool check(int cx, int cy, int cd){ int x = cx, y = cy, d = cd; vector k = m; int cnt = 0; while(cnt < c){ int mx = x + dir[d][0]; int my = y + dir[d][1]; if(mx < 0 || my < 0 || mx >= W || my >= H || k[my][mx] == '#'){ d = (d+1)%4; mx = x + dir[d][0]; my = y + dir[d][1]; if(mx < 0 || my < 0 || mx >= W || my >= H || k[my][mx] == '#'){ return false; } } k[my][mx] = '#'; cnt++; if(mx == cx && my == cy){ return (c == cnt); } x = mx, y = my; } } int main(){ cin >> H >> W; REP(i,H){ string s; cin >> s; if(s.size() != W) throw; m.push_back(s); REP(x,W) if(s[x] == '.') c++; } if(c == 1) throw; REP(y,H) REP(x,W){ if(m[y][x] != '.') continue; REP(d,4){ if(check(x,y,d)){ cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }