Problem A - Hasse Diagram

Consider a partially ordered set (poset, for short) (A,⊆), where A is a set and ⊆ a partial order. An Hasse Diagram is a very convenient and compact graphical representation of a partially ordered set displayed via the cover relation of the poset. In a few words, the cover relation of a relation R is R minus the transitivity and the reflexivity. Let us explain now how to draw a Hasse Diagram. Each node of the diagram is an element of the poset, and if two elements x and y are connected by a line then xy or yx . The position of the elements and the connections are drawn respecting the following rules:

Figure 1. Hasse Diagram representation of the Poset(S={{1,2,3,5}, {2,3}, {5}, {3}, {1,3}, {1,5}}, ⊆)


Problem

Given a set Q of naturals such that |Q|=P. Consider a set S of N subsets of Q, that is, SP(Q) and |S| = N. (S, ⊆) is then a partially ordered set. Each element K of S is a set on its own, with a maximum of P elements. The elements of K are positive and are increasingly ordered. Given such a poset, your goal is to compute all the possible paths in its Hasse diagram from the highest elements to the lowest ones.

Constraints

Input

The first line of the input contains one positive integer number N, which is the number of elements of S. The following N lines contain the elements of S, one for each line. In each integer sequence, the elements are separated by a single space.

Output

Each line of the output file has the nodes of a path, of the Hasse Diagram, separated by ->. The paths must be lexicographically ordered. Observe Figure 1 and the sample output.

Sample Input

6
1 2 3 5
2 3
5
3
1 3
1 5

Sample Output

1 2 3 5->1 3->3
1 2 3 5->1 5->5
1 2 3 5->2 3->3