#P1775B. Gardener and the Array

Gardener and the Array

Description

The gardener Kazimir Kazimirovich has an array of nn integers c1,c2,,cnc_1, c_2, \dots, c_n.

He wants to check if there are two different subsequences aa and bb of the original array, for which f(a)=f(b)f(a) = f(b), where f(x)f(x) is the bitwise OR of all of the numbers in the sequence xx.

A sequence qq is a subsequence of pp if qq can be obtained from pp by deleting several (possibly none or all) elements.

Two subsequences are considered different if the sets of indexes of their elements in the original sequence are different, that is, the values of the elements are not considered when comparing the subsequences.

Each test contains multiple test cases. The first line contains the number of test cases tt (1t1051 \le t \le 10^5). The description of the test cases follows.

The first line of each test case contains one integer nn (1n1051 \le n \le 10^5) — the size of the array cc.

The description of the array cc in this problem is given implicitly to speed up input.

The (i+1)(i + 1)-st of the following nn lines of the test case begins with an integer kik_i (1ki1051 \le k_i \le 10^5) — the number of set bits in the number cic_i. Next follow kik_i distinct integers pi,1,pi,2,,pi,kip_{i, 1}, p_{i, 2}, \dots, p_{i, k_i} (1pi21051 \le p_i \le 2 \cdot 10^5) —the numbers of bits that are set to one in number cic_i. In other words, ci=2pi,1+2pi,2++2pi,kic_i = 2^{p_{i, 1}} + 2^{p_{i, 2}} + \ldots + 2^{p_{i, k_i}}.

It is guaranteed that the total sum of kik_i in all tests does not exceed 10510^5.

For each set of input, print "Yes" if there exist two different subsequences for which f(a)=f(b)f(a) = f(b), and "No" otherwise.

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.

Input

Each test contains multiple test cases. The first line contains the number of test cases tt (1t1051 \le t \le 10^5). The description of the test cases follows.

The first line of each test case contains one integer nn (1n1051 \le n \le 10^5) — the size of the array cc.

The description of the array cc in this problem is given implicitly to speed up input.

The (i+1)(i + 1)-st of the following nn lines of the test case begins with an integer kik_i (1ki1051 \le k_i \le 10^5) — the number of set bits in the number cic_i. Next follow kik_i distinct integers pi,1,pi,2,,pi,kip_{i, 1}, p_{i, 2}, \dots, p_{i, k_i} (1pi21051 \le p_i \le 2 \cdot 10^5) —the numbers of bits that are set to one in number cic_i. In other words, ci=2pi,1+2pi,2++2pi,kic_i = 2^{p_{i, 1}} + 2^{p_{i, 2}} + \ldots + 2^{p_{i, k_i}}.

It is guaranteed that the total sum of kik_i in all tests does not exceed 10510^5.

Output

For each set of input, print "Yes" if there exist two different subsequences for which f(a)=f(b)f(a) = f(b), and "No" otherwise.

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.

样例输入 1

5
3
2 1 5
2 2 4
2 2 3
2
2 1 2
1 2
4
3 1 2 4
2 2 4
4 1 2 5 6
2 2 5
5
3 3 1 2
3 2 5 3
5 7 2 3 1 4
5 1 2 6 3 5
3 2 6 3
2
1 1
1 2

样例输出 1

No
Yes
Yes
Yes
No

Note

It can be proven that in the first test case there are no two different subsequences aa and bb for which f(a)=f(b)f(a) = f(b).

In the second test case, one of the possible answers are following subsequences: the subsequence aa formed by the element at position 11, and the subsequence bb formed by the elements at positions 11 and 22.

In the third test case, one of the possible answers are following subsequences: the subsequence aa formed by elements at positions 11, 22, 33 and 44, and the subsequence bb formed by elements at positions 22, 33 and 44.