#include using namespace std; #define rep(i, a) for (int i = 0; i < (a); i++) #define rep2(i, a, b) for (int i = (a); i < (b); i++) #define repr(i, a) for (int i = (a) - 1; i >= 0; i--) #define repr2(i, a, b) for (int i = (b) - 1; i >= (a); i--) template bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); } template bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); } typedef long long ll; int h, w; string g[111]; char isWall(int y, int x) { if (y < 0 || y >= h || x < 0 || x >= w) return true; return g[y][x] == '#'; } int main() { cin >> h >> w; rep(i, h) cin >> g[i]; pair start(1e9, 1e9); rep(i, h) rep(j, w) if (g[i][j] == '.') chmin(start, make_pair(i, j)); int sy = start.first; int sx = start.second; const int dy[] = { 0, 1, 0, -1 }; const int dx[] = { 1, 0, -1, 0 }; int y = sy; int x = sx; int dir = 1; int R = 0; int L = 0; while (true) { while (!isWall(y + dy[dir], x + dx[dir])) { y += dy[dir]; x += dx[dir]; g[y][x] = '#'; } int ld = (dir + 3) % 4; int rd = (dir + 1) % 4; if (!isWall(y + dy[rd], x + dx[rd])) { dir = rd; R++; } else if (!isWall(y + dy[ld], x + dx[ld])) { dir = ld; L++; } else break; } bool all = true; rep(i, h) rep(j, w) all &= g[i][j] == '#'; cout << (all ? "YES" : "NO") << endl; return 0; }