Welcome to ZOJ
Information
Problems
Runs
Statistics
Ranklist
Clarification
46 - Andrew Stankevich's Contest, Warmup - 1008
Don't Go Left

Time Limit: 2 Seconds      Memory Limit: 65536 KB


Input

The input contains multiple test cases.
The first line of the input is a single integer T (1 <= T <= 40) which is the number of test cases.
T test cases follow, each preceded by a single blank line.


Output

For each case, print "YES" if the TM given is consecutive and "NO" if it is not.


Sample Input

2

4 3
1 1 1
2 2 0
3 3 1
2 1 -1
2 2 0
2 3 0
3 1 1
4 3 1
2 3 0

2 2
1 1 1
1 1 -1

Sample Output

YES
NO

Author: Andrew Stankevich


Submit    Status