Consider a situation that we need to distribute n gifts to n people fairly and randomly. For this purpose one ancient technique is popular in Asia, and is usually used to represent a random permutation. Chinese call it Ghost Leg, Japanese Budda Lots and Korean Ladder Game. We first start with some terms. This ladder consists of several vertical poles and horizontal bars connecting two adjacent vertical poles. From the top of each vertical pole, a path is traced through the ladder using the following three steps:
1. When tracing a vertical pole, continue downwards until an end of the first bar is reached, then continue along the bar.
2. When tracing a bar, continue along it until the end of the bar is reached, then continue down the vertical pole.
3. Repeat Step 1 and Step 2 until the bottom of a vertical pole is reached.
Figure D.1(a) shows a ladder L with three vertical poles and three bars. The vertical poles are numbered with 1, … , n from left to right. The paths of tracing these three vertical poles are shown in (b), (c), and (d). The input (1, 2, 3) is permuted finally to
)
by the ladder L. Note that we do not allow the case that two immediately adjacent horizontal bars meet at some point (like w in Figure D.1(e)) because there is no unique way in tracing at the point.
You are given a ladder L which achieves a permutation

.If the permutation

is unchanged after removing a bar, then the bar is said to be redundant for

. Your task is to find all redundant bars for

. This is equivalent to constructing a minimal ladder by removing all redundant bars from L. In the minimal ladder of L, the removal of any bar from the ladder gives a different permutation from

.
Your program is to read from standard input. The input starts with a line containing one integers n (3 ≤ n ≤ 50), where n is the number of vertical poles. The vertical poles are ordered from left to right. Let ݀

denote the depth of the ݆j-th bar between the i-th and (i + 1)-th poles from the top, which is an integer between 1 and 1,000. In the following n − 1 lines, the i-th line contains the sequence of depths ݀

, where 1 ≤ i < n, ݆j ≥ 1 and ݀

. Notice that this depth sequence is ended with zero (0), which is not a depth but just a marker to indicate the end of the sequence. See Figure D.2 for illustration.