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>
using namespace std;
int n,m;
bool ok[13][13],dp[4100];
int main(){
	cin>>n>>m;
	vector<string>a(n);
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<50000;i++){
		random_shuffle(a.begin(),a.end());
		memset(ok,1,sizeof(ok));
		for(int i=0;i<m;i++)for(int j=i+1;j<m;j++)for(int k=0;k<n&&ok[i][j];k++)if(a[k][i]!=a[n-1-k][j])ok[i][j]=0;
		memset(dp,0,sizeof(dp));
		dp[0]=1;
		for(int i=0;i<(1<<m);i++)if(dp[i])
			for(int j=0;j<m;j++)if((i&(1<<j))==0)
				for(int k=j+1;k<m;k++)if(ok[j][k]&&(i&(1<<k))==0)
					dp[i|(1<<j)|(1<<k)]=1;
		bool final_=0;
		if(m%2==0) final_=dp[(1<<m)-1];
		else for(int i=0;i<m;i++) final_|=dp[(1<<m)-1-(1<<i)];
		if(final_){
			puts("YES");return 0;
		}
	}
	puts("NO");
}