Efficient Codes

In the C programming language, the programmers are allowed to include header files (.h files) into their source files (.c files). For example, in a source file "example.c" you may write like this:

#include "header_0.h"
#include "header_1.h"
#include
...

int main()
{
...
}
However, in some cases the header files themselves may include one another. For example, in the above example the header file "header_1.h" may have already included "stdio.h". In that case, "header_1.h" may look like this:

#include
#include
...

void function1();
...
So after all, you just have to include "header_0.h" and "header_1.h" in your "example.c". Although it is usually harmless if you actually have included a header file several times in your source file, you just want to eliminate those useless codes to make your code as short as possible. Therefore, you decide to write a program to do this task.

Input

The input contains multiple test cases!

Each case begins with a number N (1 <= N <= 100) indicating the number of header files included by a source file. Then the descriptions of header files are given. For each file, the description consists of two lines. On the first line, the name of that file is given. The second line starts with a number M, followed by M strings which represent the name of files included by the given one. File names will contain only lower case letters ('a'..'z'), number characters ('0'..'9'), the underscore character ('_') or the dot character ('.'). The length of each file name is between 3 and 20 and the number of characters in a line never exceeds 2000. It is also assumed that there is no circular including (that is, A includes B and B also includes A, or even A includes B and B includes C and C includes A, and so on) in your files because that usually causes a compilation error.

Proceed to the End Of File(EOF).

Output

For each test case, output the minimum set of files that should be directly included by the source file. Each file name occupies a line and they should be listed in the alphabetic order.

Separate two consecutive test cases with a blank line, but Do NOT output an extra blank line after the last one.

Sample Input
3
header_0.h
0
header_1.h
1 stdio.h
stdio.h
0
2
a.h
3 b.h c.h d.h
e.h
0
Sample Output
header_0.h
header_1.h

a.h
e.h

https://max.book118.com/html/2016/0229/36382785.shtm