#P16A. Flag

Flag

机翻

根据国际标准化组织的新标准,每个国家的国旗都应该有一个棋盘格。 n × m每一个方块应该是10种颜色中的一种,而且国旗应该是 "条纹 "的:国旗的每一横排应该包含相同颜色的方块,而相邻横排的颜色应该不同。Berland的政府要求你找出他们的国旗是否符合ISO的新标准。

输入的第一行包含数字 nm(1 ≤ n, m ≤ 100), n- 行的数量、 m- Berland旗帜上的列的数量。然后是对该旗帜的描述:下面的每一 n行都包含 m字符。每个字符都是0 和9 之间的数字,代表相应方格的颜色。

如果国旗符合ISO新标准,则输出YES ,否则输出NO 。

Description

According to a new ISO standard, a flag of every country should have a chequered field n × m, each square should be of one of 10 colours, and the flag should be «striped»: each horizontal row of the flag should contain squares of the same colour, and the colours of adjacent horizontal rows should be different. Berland's government asked you to find out whether their flag meets the new ISO standard.

The first line of the input contains numbers n and m (1 ≤ n, m ≤ 100), n — the amount of rows, m — the amount of columns on the flag of Berland. Then there follows the description of the flag: each of the following n lines contain m characters. Each character is a digit between 0 and 9, and stands for the colour of the corresponding square.

Output YES, if the flag meets the new ISO standard, and NO otherwise.

Input

The first line of the input contains numbers n and m (1 ≤ n, m ≤ 100), n — the amount of rows, m — the amount of columns on the flag of Berland. Then there follows the description of the flag: each of the following n lines contain m characters. Each character is a digit between 0 and 9, and stands for the colour of the corresponding square.

Output

Output YES, if the flag meets the new ISO standard, and NO otherwise.

Samples

3 3
000
111
222
YES
3 3
000
000
111
NO
3 3
000
111
002
NO