P11061 [CodeChef] nita02
NOI
题目描述

At the function of Republic day at NIT Agartala the warden of hostel has to visit the ground and
check the arrangement of the chairs for guests.
In the ground of NIT Agartala all the chairs are arranged in N rows and M columns.

Warden has to check that in each row all the chairs must have same color and adjacent rows have different colors chair.

Input
First line contains two integer N and M.
Next N lines contains M values between 0 to 9 colors of chairs

Output
Print YES if the arrangement is good else print NO.

Example

Input:
5 6
0 0 0 0 0 0
1 1 1 1 1 1
2 2 2 2 2 2
1 1 1 1 1 1
3 3 3 3 3 3
Output:
YES
Input:
5 6
0 0 0 0 1 0
1 1 1 1 1 1
1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3 3
Output:
NO

输入格式

见题面

输出格式

见题面

样例输入
5 6 0 0 0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3
样例输出
NO