시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 0 0 0 0.000%

문제

Conan is a detective in a city called ACM. Recently, a rare book was stolen in the library of City University of ACM. Many students had been to the library on the day that the book was stolen. Each had entered once, stayed for some time, and then left. We assume if two were in the library at the same time, then at least one of them saw the other. Conan met all students that had been to the library on the day, and asked whom they saw in the library. Now, Conan would like to determine whether there could be a situation as in the testimony. For example, suppose four students had been to the library, and their testimony is as follows:

Student_1: I saw Student_4 and Student_2.
Student_2: I saw Student_3.
Student_3: I saw Student_2 and Student_4
Student_4: I saw Student_1.

There couldn’t be such a situation under the assumption that at least one of two students saw the other if two were in the library at the same time. Because Student_2 and Student_4 did not see each other, we can deduce the two students were in the library at different times. And, both Student_1 and Student_3 saw Student_2 and Student_4, we can deduce that there is a time when Student_1 and Student_3 were in the library together. So, at least one of Student_1 and Student_3 should have seen the other.

For another example, suppose three students had been to the library, and their testimony is as follows:

Student_1: I saw Student_3 and Student_2.
Student_2: I saw Student_1.
Student_3: I saw Student_2.

There could be such a situation. If three students were in the library at the same time, this situation can happen.

Given a testimony you are to write a program to help Conan whether there could be a situation as in the testimony under the assumption described above.

입력

Your program is to read from standard input. The input consists of T test cases. The number of test cases T is given in the first line of the input. The first line of each test case contains a single integer n representing the number of students, 1 ≤ n ≤ 200 . Each i -th ( 1 ≤ i ≤ n ) line of the following n lines contains integers representing the number of students whom Student_ i saw in the library, followed by id’s of the students. In case Student_ i said that he did not see any student in the library, the number of students is indicated as 0. The integers given in a line are separated by a space.

출력

Your program is to write to standard output. Print exactly one line for each test case. The line is to contain YES if there could be such a situation as in the testimony. Otherwise, the line is to contain NO. 

예제 입력

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

예제 출력

NO
YES
YES

힌트