eolymp
bolt
Try our new interface for solving problems
Problems

In case of failure

In case of failure

To help their clients deal with faulty Cash Machines, the board of The Planar Bank has decided to stick a label expressing sincere regret and sorrow of the bank about the failure on every ATM. The very same label would gently ask the customer to calmly head to the nearest Machine (that should hopefully work fine).

In order to do so, a list of two-dimensional locations of all n ATMs has been prepared, and your task is to find for each of them the one closest with respect to the Euclidean distance.

Input

The first line contains the number of tests cases t (t15). Each test case begin with the number of Cash Machines n (2n10^5). Each of the next n lines contains the coordinates of one Cash Machine x and y (0x, y109). No two points in one test case will coincide.

Output

For each test case output n lines. i-th of them should contain the squared distance between the i-th ATM from the input and its nearest neighbor.

Time limit 1 second
Memory limit 64 MiB
Input example #1
2
10
17 41
0 34
24 19
8 28
14 12
45 5
27 31
41 11
42 45
36 27
15
0 0
1 2
2 3
3 2
4 0
8 4
7 4
6 3
6 1
8 0
11 0
12 2
13 1
14 2
15 0
Output example #1
200
100
149
100
149
52
97
52
360
97
5
2
2
2
5
1
1
2
4
5
5
2
2
2
5
Source 2008 ACM Central Europe, November 28-30, Problem J