1030: Adjacency List
Memory Limit:1024 MB
Time Limit:2.000 S
Judge Style:Text Compare
Creator:
Submit:30
Solved:10
Description
There are cities numbered , and roads connecting cities.
The -th road connects city and city .
Print lines as follows.
- Let be the number of cities directly connected to city , and those cities be city , , city , in ascending order.
- The -th line should contain integers in this order, separated by spaces.
Input
The input is given from Standard Input in the following format:
- if .
- All values in the input are integers.
Output
Print 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 are city , city , and city . Thus, we have , so you should print in the first line in this order, separated by spaces.
Note that must be in ascending order. For instance, it is unacceptable to print in the first line in this order.