5
2 4 3 0
1 0
4 5 0
1 3 0
1 2 3 4 0

3
2 3 0
1 3 0
1 2 0

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

10
2 5 4 7 8 0
3 5 4 7 0
9 8 7 5 2 10 1 0
2 5 8 7 9 6 5 4 10 0
1 2 3 6 9 0
9 8 7 4 5 0
1 4 5 9 8 2 0
8 6 5 4 7 9 6 3 1 0
0
0