5 2
7 8
0 1 4 1 2 2 1 0
0 1 2 2 1 1 1 2 0
