#!/usr/bin/ python3.8 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines H, W = map(int, readline().split()) A = ['#' * (W + 2)] for _ in range(H): A.append('#' + readline().decode().rstrip() + '#') A += ['#' * (W + 2)] A = tuple(''.join(A)) H += 2 W += 2 dx = (1, -W, -1, W) S = A.index('.') def get_path(i, di): x = S path = [x] se = set([x]) while True: d = dx[i] if A[x + d] == '.': x += d if x in se: return path path.append(x) se.add(x) continue i = (i + di) % 4 d = dx[i] if A[x + d] == '.': x += d if x in se: return path path.append(x) se.add(x) continue return path path1 = get_path(0, -1) path2 = [] P = get_path(3, 1)[1:] n = sum(x == '.' for x in A) seP = set(path1) seQ = set() p = 0 found = False while path1: while True: if p < len(P) and ((P[p] not in seP) or (P[p] == path1[-1])): seQ.add(P[p]) path2.append(P[p]) p += 1 else: break if path1[-1] == path2[-1] and len(path1) + len(path2) == n + 1: found = True break seP.remove(path1.pop()) print('YES' if found else 'NO')