1030: Adjacency List

Memory Limit:1024 MB Time Limit:2.000 S
Judge Style:Text Compare Creator:
Submit:30 Solved:10

Description

There are lns="http://www.w3.org/1998/Math/MathML"> cities numbered lns="http://www.w3.org/1998/Math/MathML">1,,, and lns="http://www.w3.org/1998/Math/MathML"> roads connecting cities.
The lns="http://www.w3.org/1998/Math/MathML">-th road lns="http://www.w3.org/1998/Math/MathML">(1) connects city lns="http://www.w3.org/1998/Math/MathML"> and city lns="http://www.w3.org/1998/Math/MathML">.

Print lns="http://www.w3.org/1998/Math/MathML"> lines as follows.

  • Let lns="http://www.w3.org/1998/Math/MathML"> be the number of cities directly connected to city lns="http://www.w3.org/1998/Math/MathML">(1), and those cities be city lns="http://www.w3.org/1998/Math/MathML">,1lns="http://www.w3.org/1998/Math/MathML">, city lns="http://www.w3.org/1998/Math/MathML">,, in ascending order.
  • The lns="http://www.w3.org/1998/Math/MathML">-th line lns="http://www.w3.org/1998/Math/MathML">(1) should contain lns="http://www.w3.org/1998/Math/MathML">+1 integers lns="http://www.w3.org/1998/Math/MathML">,,1,,, in this order, separated by spaces.

Input

The input is given from Standard Input in the following format:


 lns="http://www.w3.org/1998/Math/MathML">
 lns="http://www.w3.org/1998/Math/MathML">1
 lns="http://www.w3.org/1998/Math/MathML">

  • lns="http://www.w3.org/1998/Math/MathML">1105
  • lns="http://www.w3.org/1998/Math/MathML">1<(1)
  • lns="http://www.w3.org/1998/Math/MathML">(,)(,) if lns="http://www.w3.org/1998/Math/MathML">().
  • All values in the input are integers.

lns="http://www.w3.org/1998/Math/MathML">

Output

Print lns="http://www.w3.org/1998/Math/MathML"> lines as specified in the Problem Statement.

Sample Input Copy

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

Sample Output Copy

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

HINT

The cities directly connected to city lns="http://www.w3.org/1998/Math/MathML">1 are city lns="http://www.w3.org/1998/Math/MathML">2, city lns="http://www.w3.org/1998/Math/MathML">3, and city lns="http://www.w3.org/1998/Math/MathML">6. Thus, we have lns="http://www.w3.org/1998/Math/MathML">1=3,1,1=2,1,2=3,1,3=6, so you should print lns="http://www.w3.org/1998/Math/MathML">3,2,3,6 in the first line in this order, separated by spaces.

Note that lns="http://www.w3.org/1998/Math/MathML">,1,,, must be in ascending order. For instance, it is unacceptable to print lns="http://www.w3.org/1998/Math/MathML">3,3,2,6 in the first line in this order.