I. Critical Structures
time limit per test
3 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
1
6 6
1 2
2 3
3 4
4 5
5 6
6 1
Output
0 0 1 6
Input
1
6 7
1 2
2 3
3 1
4 5
5 6
6 4
1 4
Output
2 1 1 1