e-olymp
Competitions

Graphs Representation

Reverse me!

Vasya the boy likes to reverse the oriented graphs. Help him in it.

Input

The first number is n (1n50000) - the number of vertices in a graph. The next n lines contain the graph in the form of adjacency list: the i-th line contains the list of vertices in increasing order that are adjacent to i-th vertex. The numeration of vertices starts with one. It is guaranteed that the number of edges in a graph is no more than 50000.

Output

Print the reverse graph in the same format like the input graph.

Time limit 1 second
Memory limit 128 MiB
Input example #1
4
2 3
3

2
Output example #1
4

1 4
1 2

Input example #2
2
2
1
Output example #2
2
2
1