Closest Point

No attempts yetTime limit3sMemory limit128 MB

Problem

You are given NN points on a 2D plane. Let the coordinates of point ii be (xi,yi)(x_i, y_i).

For two points ii and jj, define the distance as

dist(i,j)=(xjxi)2+(yjyi)2\operatorname{dist}(i, j) = (x_j - x_i)^2 + (y_j - y_i)^2

that is, the squared Euclidean distance between the two points.

For each point ii, find and print the minimum distance to any other point:

min1jN, jidist(i,j)\min_{1 \le j \le N,\ j \ne i} \operatorname{dist}(i, j)

Input

The input consists of several test cases.

The first line contains the number of test cases TT (1T151 \le T \le 15).

For each test case, the first line contains the number of points NN (2N1052 \le N \le 10^5). Each of the following NN lines contains the coordinates xix_i and yiy_i (0xi,yi1090 \le x_i, y_i \le 10^9) of a point, separated by a space.

Output

For each test case, print NN lines.

The ii-th line must contain the value of min1jN, jidist(i,j)\min_{1 \le j \le N,\ j \ne i} \operatorname{dist}(i, j) for point ii.

Two distinct points may share the same location; in that case the value is 00.