In a faraway kingdom, there lived a king who had sons. In this kingdom, there were also beautiful maidens, and the king knew which maidens each of his sons liked. Since the sons were young and carefree, each could like several maidens at the same time.
One day, the king instructed his advisor to select a suitable maiden for each son so that he could marry her. The advisor completed the task: for each son, he picked a maiden that he liked and ensured that each maiden was chosen for only one son.
Upon reviewing the list of brides, the king said: "I like this list, but I want to know, for each son, the list of all maidens he can marry. Naturally, all sons must also be able to marry the maidens they like."
This task turned out to be very difficult for the advisor. Help him escape execution by solving it.
The first line contains the number — the number of sons (1 \leq n \leq 2000). Each of the following lines contains a list of maidens liked by each son. The -th such line begins with k_i — the number of maidens liked by the -th son, followed by k_i numbers representing the indices of these maidens. The total sum of all k_i does not exceed .
The last line contains the list compiled by the advisor: different numbers from to , where for each son, the number is the index of the maiden he can marry. It is guaranteed that the list is correct, i.e., each son likes his assigned maiden.
The output should consist of lines. For each son, output l_i — the number of different maidens he can marry. Then output l_i numbers — the indices of these maidens in any order.
Example 1