It is just a mining spanning tree ( 最小生成树 ) problem, what makes you a little difficult is that you are in a 3D space.
For each test case, output a line with the answer, which should accurately rounded to two decimals .
2 2 1 1 0 2 2 0 3 1 2 3 0 0 0 1 1 1
1.41 3.97