There are multiple test cases, terminated by a line "0".
For each test case, the first line contains a integer n (1<=n<=1000).
The following are n lines representing the set of each node. For every line, there is a integer p first, indicating the size of the set. Then there are p integers, indicating the node with index from 1 to n in this set.