Farmer John's cows, numbered from to as always, happen to have too much time on their hooves. As a result, they have worked out a complex social hierarchy related to the order in which Farmer John milks them every morning.
After weeks of study, Farmer John has made observations about his cows' social structure. Each observation is an ordered list of some of his cows, meaning that these cows should be milked in the same order in which they appear in the list. For example, if one of Farmer John's observations is the list , Farmer John should milk cow at some point before cow , and cow at some point before cow .
Farmer John's observations are prioritized, so his goal is to maximize the value such that his milking order satisfies the conditions given by the first observations. If several milking orders satisfy these first conditions, Farmer John follows a long-standing tradition according to which cows with smaller numbers outrank cows with larger numbers, so he would like to milk the lowest-numbered cows first. More formally, if several milking orders satisfy these conditions, Farmer John would like to use the lexicographically smallest one. An order is lexicographically smaller than an order if there exists such that x_i = y_i for all i < j and x_j < y_j (in other words, the two orders coincide up to some position, at which has a smaller element than ).
Help Farmer John determine the best order in which to milk his cows.
The first line contains two integers and m~(1 \le n \le 10^5, 1 \le m \le 5 \cdot 10^4). Each of the next lines describes one observation: the (i + 1)-th line describes observation and starts with the number m_i of cows in the observation, followed by m_i integers — the numbers of these cows in the required order. The sum of all m_i does not exceed 2 \cdot 10^5.
Print integers — a permutation of the numbers from to specifying the order in which Farmer John should milk his cows.
Here, Farmer John has cows. He should milk cow before cow , and cow before cow (the first observation); cow before cow (the second observation); and cow before cow , and cow before cow (the third observation). The first two observations can be satisfied simultaneously, but Farmer John cannot meet all three at once, since this would require cow to come before cow and cow to come before cow .
Therefore, there are two orders satisfying the first two observations: 1, 4, 2, 3 and 4, 1, 2, 3; the first one is lexicographically smaller.
Example 1