atcoder#ABC276B. [ABC276B] Adjacency List
[ABC276B] Adjacency List
Score : points
Problem Statement
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.
Constraints
- if .
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print lines as specified in the Problem Statement.
6 6
3 6
1 3
5 6
2 5
1 2
1 6
3 2 3 6
2 1 5
2 1 6
0
2 2 6
3 1 3 5
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.
5 10
1 2
1 3
1 4
1 5
2 3
2 4
2 5
3 4
3 5
4 5
4 2 3 4 5
4 1 3 4 5
4 1 2 4 5
4 1 2 3 5
4 1 2 3 4