#P1434E. A Convex Game
A Convex Game
Description
Shikamaru and Asuma like to play different games, and sometimes they play the following: given an increasing list of numbers, they take turns to move. Each move consists of picking a number from the list.
Assume the picked numbers are , , , . The following conditions must hold:
- for all ;
- for all .
However, it's easy to play only one instance of game, so today Shikamaru and Asuma decided to play simultaneous games. They agreed on taking turns as for just one game, Shikamaru goes first. At each turn, the player performs a valid move in any single game. The player who cannot move loses. Find out who wins, provided that both play optimally.
The first line contains the only integer () standing for the number of games Shikamaru and Asuma play at once. Next lines describe the games.
Each description starts from a line with the only number () denoting the length of the number list. The second line contains the increasing space-separated sequence , , ..., from the game ().
The total length of all sequences doesn't exceed .
Print "YES" if Shikamaru can secure the victory, and "NO" otherwise.
Input
The first line contains the only integer () standing for the number of games Shikamaru and Asuma play at once. Next lines describe the games.
Each description starts from a line with the only number () denoting the length of the number list. The second line contains the increasing space-separated sequence , , ..., from the game ().
The total length of all sequences doesn't exceed .
Output
Print "YES" if Shikamaru can secure the victory, and "NO" otherwise.
Note
In the first example Shikamaru can pick the last number, and Asuma cannot do anything because of the first constraint.
In the second sample test Asuma can follow the symmetric strategy, repeating Shikamaru's moves in the other instance each time, and therefore win.