#20. Support or Not
Support or Not
Problem Description
There are spheres in the three-dimensional space, labeled by . The center of the -th sphere is at point , and its radius is .
Let us denote the distance between spheres and as
$$d(i,j) = max{\left(0, \sqrt{(x_i-x_j)^2 + (y_i-y_j)^2 + (z_i-z_j)^2} - r_i - r_j\right)} $$That means choosing two points and , where is inside or on the surface of sphere and is inside or on the surface of sphere , and minimizing the Euclidean distance between and .
There are pairs such that . Please find the smallest values among the values of for all these pairs.
Input
The first line of the input contains an integer , denoting the number of test cases.
Each test case starts with a single line containing two integers and $(2\le n\le 100000, 1\le k\le \min(300,\frac {n(n−1)} 2)$, denoting the number of spheres and the parameter .
Each of the next lines contains four integers, , , , and , , describing -th sphere.
Output
For each test case, print lines, each line containing a single integer: the smallest values among , in non-decreasing order. To avoid precision error, print the values of : the values of the respective rounded up. For example, , and .
Sample
1
4 6
0 0 0 1
0 3 2 2
3 2 1 1
1 1 2 2
0
0
0
1
1
2