h, w = map(int, input().split())
s = []
for i in range(h):
    s.append(list(input()))

for i in range(h):
    for j in range(w):
        if 0 <= i-1:
            up = s[i-1][j]
        else:
            up = s[i][j]
        
        if i+1 < h:
            down = s[i+1][j]
        else:
            down = s[i][j]

        if 0 <= j-1:
            left = s[i][j-1]
        else:
            left = s[i][j]
        
        if j+1 < w:
            right = s[i][j+1]
        else:
            right = s[i][j]
        
        if s[i][j] != up and s[i][j] != down and s[i][j] !=left and s[i][j] != right:
            print("No")
            exit()

print("Yes")