A. Sledding down the mountain
time limit per test
12 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

See PDF statement in attachment.

Examples
Input
1
0 0 0
1 -1 -1
1 1 1
Output
0.707106781187
Input
3
1 2 1
0 2 2
1 1 1
1 1 1
2 2 2
1 2 1
0 0 -1
1 1 1
0 2 2
Output
1.247219128925
Input
2
1 0 1
0 0 0
1 -1 -1
1 -1 -1
0 0 0
0 -1 1
Output
1.837117307087