E. The Detective Game
time limit per test
4 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

One of the cool activities that the ACPC contestants do in ACPC is playing The Detective Game, a game where they apply their problem-solving, detective, critical thinking, attention to detail, and teamwork skills.

The game consists of $$$n$$$ players, one or more of them has the role of the doctor. In each round, the players discuss who they suspect to be the doctor, and a player is selected to be on trial, meaning that the other players will vote if they think that the selected player is a doctor or not.

If strictly more than $$$50\%$$$ of the $$$n$$$ players voted to eliminate a player from this round, the player will be eliminated; otherwise, the round will end disappointedly with no change.

You are given each player's suspect list, which is the list of other players who they think that they are doctors. You want to calculate for each player independently if they are selected to be on trial in the current round, will they be eliminated or not.

Your task is to print all the players, in increasing order, who will be eliminated if they are selected on trial this round.

Input

The input starts with an integer $$$T$$$, the number of test cases. Then $$$T$$$ test cases follow.

Each test case starts with a single integer $$$n$$$ $$$(2 \leq n \leq 10^{5})-$$$the number of players.

Then $$$n$$$ lines follow $$$-$$$ the $$$i_{th}$$$ line represents the $$$i_{th}$$$ players suspect list.

Each line starts with an integer $$$k_{i}$$$ $$$(0\leq k_{i} \leq)$$$, the number of players in his list, then $$$k_{i}$$$ distinct integers follow, each number $$$a_{ij}$$$ in the list $$$(1 \leq a_{ij} \leq n, a_{ij} \ne i)$$$ means that player $$$i$$$ will vote against player $$$a_{ij}$$$ if he was on trial.

It's guaranteed that the summation of all $$$n$$$ and $$$k_{i}$$$ will not exceed $$$4 \cdot 10^{5}$$$ in all test cases.

Output

For each test case, print an integer $$$m$$$ $$$(0\leq m \leq n)-$$$ the number of players who could be eliminated if they are selected on trial this round.

Then print $$$m$$$ integers in increasing order, $$$b_{i}$$$ $$$(1\leq b_{i} \leq n)$$$ representing the players who will be eliminated if they are selected on trial.

Example
Input
1
4
3 2 3 4
1 1
2 1 2
1 1
Output
1
1