import sys import math def input(): return sys.stdin.readline().rstrip() def check(A): N = len(A) M = len(A[0]) mini = minj = math.inf maxi = maxj = -math.inf cnt = 0 for i in range(N): for j in range(M): if A[i][j] == '.': cnt += 1 mini, minj, maxi, maxj = \ min(mini, i), min(minj, j), max(maxi, i), max(maxj, j) if maxi == mini or maxj == minj: return False if cnt != 2*(maxi-mini) + 2*(maxj-minj): return False def checkrect(): for i in range(mini, maxi+1): if A[i][minj] == '#' or A[i][maxj] == '#': return False for j in range(minj, maxj+1): if A[mini][j] == '#' or A[maxi][j] == '#': return False return True if checkrect(): return False redi = redj = None for i in range(mini+1, maxi): cnt = 0 for j in range(minj, maxj+1): if A[i][j] == '.': cnt += 1 if cnt > 2: if redi is not None: return False redi = i if cnt < 2: return False for j in range(minj+1, maxj): cnt = 0 for i in range(mini, maxi+1): if A[i][j] == '.': cnt += 1 if cnt > 2: if redj is not None: return False redj = j if cnt < 2: return False if redi is None or redj is None: return False for i in range(N): for j in range(M): if A[i][j] == '.': if i == maxi: continue if j == mini: continue if i == mini and minj <= j <= redj: continue if i == redi and redj <= j <= maxj: continue if j == redj and mini <= i <= redi: continue if j == maxj and redi <= i <= maxi: continue return False return True def main(): N, M = map(int, input().split()) A = [input() for i in range(N)] for i in range(4): if check(A): print('YES') return *A, = zip(*A[::-1]) print('NO') if __name__ == '__main__': main()