N,M = map(int, input().split())
field =[]
field.append(list("."*(M+2)))
for i in range(N):
    t = list("."+input()+".")
    field.append(t)
field.append(list("."*(M+2)))
print(field)
res = 1
def dfs(x,y):
    r = 0 #周りの”.”の数を数える
    #field[x][y] = "."
    
    for dx in range(-1,2):
        for dy in range(-1,2):
            if abs(dx+dy) ==1: #ここがなかったら周り８マス探す
                nx = x + dx
                ny = y + dy
                if field[nx][ny]==".":
                    r+=1
    if r==4: return 0
    else: return 1
                    
        
                
for i in range(0,N+2):
    for j in range(0,M+2):
        if field[i][j] == "W":
            res = res *dfs(i,j)
            
if res:print("Yes")
else:print("No")