### We Are Discuss About CODECHEF SOLUTION

Team of Two CodeChef Solution

## Team of Two CodeChef Solution

## Problem

Your class recently got a maths assignment with $5$ questions. There are $N(≤20)$ students in the class and **at most** $2$ people can collaborate. For each student, you know which problems they solved.

Find out if there exists a team of two students who can together solve all problems.

### Input Format

The first line of input will contain a single integer $T$, denoting the number of test cases. $T$ test cases follow.

- Each of the following test cases contains $N+1$ lines, where $N$ is the number of students in the class.
- The first line contains a single integer $N$.
- Each of the following $N$ lines contains $K_{i}+1$ positive integers separated by whitespaces.
- In the $i_{th}$ line, the first positive integer $K_{i}$ is the number of problems the $i_{th}$ student can solve. The next $K_{i}$ integers are $x_{1},x_{2},…,x_{Ki}$, the indices of the problems this student can solve.

### Output Format

The output must consist of $T$ lines.

- Each line must contain a single string: The solution to the $i_{th}$ test case as a
`YES`

or`NO`

(where`YES`

should be returned if some pairing of students is capable of solving all the problems, and`NO`

otherwise).

You may print each character of the string in uppercase or lowercase (for example, the strings `YES`

, `yEs`

, `yes`

, and `yeS`

will all be treated as identical).

### Constraints

- $1≤T≤1000$
- $2≤N≤20$
- $0≤K_{i}≤5$
- $1≤x_{i}≤5$

### Sample 1:

4 3 1 3 1 1 4 1 3 4 5 2 4 2 3 4 5 3 1 2 4 3 1 1 1 2 1 3 2 2 1 5 3 2 3 4

NO YES NO YES

### Explanation:

**Test case $1:$** There is no student who solved the second question.

**Test case $2:$** The second student can solve the first question and the first student can solve all the remaining problems, so they can form a team to solve all the problems together.

**Test case $3:$** There is no student who solved fourth and fifth questions.

**Test case $4:$** Given $2$ people can collaborate to solve all the problems.

## SOLUTION

## Team of Two CodeChef Solution

Yhaa You have done it but next? if YOU Want to Get Others Please Visit Here **JOIN NOW**