eolymp
bolt
Try our new interface for solving problems

Wall

Statement for this problem is only available as a file.
Time limit 0.8 seconds
Memory limit 256 MiB
Input example #1
11 14
1 4
1 8
2 6
4 3
4 11
5 2
5 4
5 7
5 10
7 6
7 11
8 3
9 4
10 6
0
Output example #1
3 8
3 1 2 9 1 5 5 
5 8 1 4 3 7 2 2 1 10 1 
3 3 2 11 3 6 3 
Input example #2
4 3
1 4
2 4
3 4
1
Output example #2
2 3
3 1 1 2 1 3 1 
1 4 3