#include <iostream>
using namespace std;

int main(void){
    int H,W,c,i,j;
    char S[60][60];
    cin>>H>>W;
    for(i=0;i<H;i++){
        for(j=0;j<W;j++){
            cin>>S[i][j];
        }
    }
    for(int i=1;i<H;i++){
        for(int j=1;j<W;j++){
            if(S[i][j]!=S[i-1][j]&&S[i][j]!=S[i+1][j]&&S[i][j]!=S[i][j-1]&&S[i][j]!=S[i][j+1]){
                c++;
        }
    }
    if(c!=0){
        cout<<"No";
    }
    else{
        cout<<"Yes";
    }
    }
