You're given arrays consisting of non-negative numbers, and an integer . You will choose n-1 arrays and do the following.
Choose a prefix p_1 from the first array.
Choose a prefix p_2 from the second array.
...
Choose a prefix p_{n-1} from the (n-1)_{\text{th}} array.
For example, the prefixes of the array [] are , , , [1,2,3].
Then create a new array by connecting the chosen prefixes , b = p_1 + p_2 + ... + p_{n-1} in their order i.e. p_1 comes first then p_2 and so until p_{n-1} , note that you also cannot change the order of each prefix.
Can you choose the arrays so after doing the previous operation you will get \text{MEX}(b)=k ?
ATTENTION ! : this is important , solve by constructing an optimal sequence then report if yes or no
is the smallest non-negative integer that is not present in the array , for example : \text{MEX}([1,2,3])=0 , \text{MEX}([0,1,3])=2 and \text{MEX}([])=0.
The first line contains a single integer (1 \le t \le 10^4) — the number of test cases.
The first line of each test case contains two integers (2 \le n \le 2\cdot10^5;0 \le k \le 5 \cdot 10^5) — the count of arrays and the target .
The next lines are of the form.
\text{size} \space a_1 \space a_2 \space ... \space a_{\text{size}} (0 \le a_i \le 5 \cdot 10^5)
It is guaranteed that the sum of sizes of all arrays over all test cases does not exceed 4\cdot10^5.
For each test case print "YES" if you can choose the arrays ; otherwise print "NO".
You can output the answer in any case (For example,the strings "yEs" , "yes" , "yeS" , "Yes" will be recognized as positive answers).
Example 1
In the first test case, you can take the prefix from the first array and the prefix from the third array which gives you [0,2,0,1] obtaining \text{MEX}([0,2,0,1])=3 , so our answer is YES !.
In the third test case, you can take the prefix [3,1,0] from the first array and an empty prefix from the second array.
The resulting array b = [3,1,0]. \text{MEX}(b) = 2 , so the answer is YES !.
Let be equal to the sum of sizes of all arrays over all test cases i.e. \displaystyle m=\sum_{i=1}^n \text{size}_i overall tests.
Subtask ( points): (m \le 5000)
Subtask ( points): the number of distinct elements in each array is equal to .
Subtask ( points): no additional constraints.