#!/usr/bin/env python3

def solve(h,w,s):
    for i in range(h):
        for j in range(w):
            if not (s[i][j] == s[i-1][j] or \
                    s[i][j] == s[i+1][j] or \
                    s[i][j] == s[i][j-1] or \
                    s[i][j] == s[i][j+1]):
                return "No"
    return "Yes"



def main():
    H,W = map(int,input().split())
    s = ['.'*55]*55
    for i in range(H):
        s[i] = input() + '.'*(55-W)
    print(solve(H,W,s))
    return

if __name__ == '__main__':
    main()
