404698: GYM101611 I Infinite Gift

Memory Limit:512 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Infinite Gifttime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard output

Vasya the Infinite has received a very dull present — the integer lattice . Formally, the lattice consists of all k-dimensional vectors with integer coordinates.

Disappointed by the present, Vasya decided to make the lattice prettier. He performed the following procedure n times: choose a vector , and then for every element connect a and a + vi with a piece of string. Note that Vasya may have chosen the same vector more than once, but he has never chosen zero vector vi = (0, ..., 0).

After this tedious procedure Vasya discovered that the lattice is now connected, that is, for any pair of elements one can get from a to b by travelling along pieces of string several times. It is allowed to traverse each piece of string in both ways.

To make the lattice even prettier, Vasya now wants to color each vector of his lattice either white or black so that any two vectors directly connected with a piece of string have different colors. Vasya's patience is not infinite, so you need to help him quick!

Input

The first line contains two integers n and k (1 ≤ k ≤ n ≤ 1500) — the number of times Vasya has chosen a vector and the dimension of the lattice.

Next n lines describe vectors v1, v2, ..., vn. The i-th of these lines contains k integers vi, 1, ..., vi, k ( - 1000 ≤ vi, j ≤ 1000). It is guaranteed that all vectors vi are non-zero, and that the lattice is connected.

Output

Print "Yes" if it is possible to color the lattice in two colors, or "No" otherwise.

ExamplesInput
2 2
1 0
0 1
Output
Yes
Input
3 2
1 0
0 1
1 1
Output
No
Input
2 1
1
-3
Output
Yes
Note

In the first sample, a chessboard coloring is a valid coloring of the lattice.

In the second sample, there exists no valid coloring of vectors (0, 0), (1, 0), (1, 1).

加入题单

算法标签: