x,y = map(int,input().split())
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(list(input()))

    except:
        break;
s=0
for i in range(x):
  for j in range(y):
    if  ((listA[i][j]!=listA[max(0,i-1)][j])&(listA[i][j]!=listA[min(x-1,i+1)][j])&
    (listA[i][j]!=listA[i][max(0,j-1)])&(listA[i][j]!=listA[i][min(y-1,j+1)])):
      s+=1
if s==0:
  print('Yes')
else:
  print('No')