https://loj.ac/problem/3109
8 3 1 1 1 3 1 1 2 3 1 2 1 3 1 2 2 3 2 4 1 3 2 4 2 3 1 5 1 3 1 5 2
1 0 3 1 6 2 8 0