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


judge = "Yes"
for i in range(h-1):
    for j in range(w-1):
        if i > 0 and j > 0 and i < h and j < w:
            if s[i][j] != s[i-1][j] and s[i][j] != s[i+1][j] and s[i][j] != s[i][j-1] and s[i][j] != s[i][j+1]:
                judge = "No"
                break
        elif i > 0 and j > 0 and i == h and j < w:
            if s[i][j] != s[i+1][j] and s[i][j] != s[i][j-1] and s[i][j] != s[i][j+1]:
                judge = "No"
                break
        elif i > 0 and j > 0 and i < h and j == w:
            if s[i][j] != s[i-1][j] and s[i][j] != s[i+1][j] and s[i][j] != s[i][j-1]:
                judge = "No"
                break
        elif i > 0 and j == 0 and i < h and j < w:
            if s[i][j] != s[i-1][j] and s[i][j] != s[i+1][j] and s[i][j] != s[i][j+1]:
                judge = "No"
                break
        elif i == 0 and j > 0 and i < h and j < w:
            if s[i][j] != s[i+1][j] and s[i][j] != s[i][j-1] and s[i][j] != s[i][j+1]:
                judge = "No"
                break

print(judge)