There is an H \times W grid (H vertical, W horizontal), where each square contains a lowercase English letter. Specifically, the letter in the square at the i-th row and j-th column is equal to the j-th character in the string S_i.

Snuke can apply the following operation to this grid any number of times:

* Choose two different rows and swap them. Or, choose two different columns and swap them.



Snuke wants this grid to be symmetric. That is, for any 1 \leq i \leq H and 1 \leq j \leq W, the letter in the square at the i-th row and j-th column and the letter in the square at the (H + 1 - i)-th row and (W + 1 - j)-th column should be equal.

Determine if Snuke can achieve this objective.

Constraints

* 1 \leq H \leq 12
* 1 \leq W \leq 12
* |S_i| = W
* S_i consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:


H W
S_1
S_2
:
S_H


Output

If Snuke can make the grid symmetric, print `YES`; if he cannot, print `NO`.

Examples

Input

2 3
arc
rac


Output

YES


Input

3 7
atcoder
regular
contest


Output

NO


Input

12 12
bimonigaloaf
faurwlkbleht
dexwimqxzxbb
lxdgyoifcxid
ydxiliocfdgx
nfoabgilamoi
ibxbdqmzxxwe
pqirylfrcrnf
wtehfkllbura
yfrnpflcrirq
wvcclwgiubrk
lkbrwgwuiccv


Output

YES
#include<bits/stdc++.h>
#define LL long long
using namespace std;
int VisCol[21],VisRow[21],N,M;
string Compos[21];
char Ch[21][21];
bool Mirrored(int C1,int C2){
	for(int J=1;J<=N;J++) if(Ch[VisRow[J]][C1]!=Ch[J][C2]) return 0;
	return 1;
}
void DFS2(int X,bool Can){
	if(X==M+1)  exit(!printf("YES\n"));
	if(VisCol[X]>0) return void(DFS2(X+1,Can));
	for(int I=X+1;I<=M;I++)
		if((!VisCol[I])&&(Mirrored(I,X))){
			VisCol[I]=X,VisCol[X]=I;
			DFS2(X+1,Can);
			VisCol[I]=VisCol[X]=0;
		}
	if(Mirrored(X,X)&&Can) VisCol[X]=X,DFS2(X+1,0),VisCol[X]=0;
}
void DFS1(int X,bool Can){
	if(X==N+1) return void(DFS2(1,M&1));
	if(VisRow[X]>0) return void(DFS1(X+1,Can));
	for(int I=X+1;I<=N;I++)
		if((!VisRow[I])&&(Compos[I]==Compos[X])){
			VisRow[I]=X,VisRow[X]=I;
			DFS1(X+1,Can);
			VisRow[I]=VisRow[X]=0;
		}
	if(Can) VisRow[X]=X,DFS1(X+1,0),VisRow[X]=0;
}
int main(){
	scanf("%d%d",&N,&M);
    for(int I=1;I<=N;I++){
    	for(int J=1;J<=M;J++){
    		char Str='\0';
    		while(!isalpha(Str)) Str=getchar();
    		Ch[I][J]=Str;
    		Compos[I]+=Ch[I][J];
		}
		sort(Compos[I].begin(),Compos[I].end());
	}
	DFS1(1,N&1);
	printf("NO\n");
	return 0;
}
