Projection in $\mathbb{R}^3$#2958

Projection in $\mathbb{R}^3$

4 seconds
256 megabytes
Hard

Given three-dimensional points, find the closest point to each one. The distance between points is defined as:

Input

The first line contains the number of points (2 \leq N \leq 3 \cdot 10^4). Each of the next lines contains three integers , , and — the coordinates of a point, where 0 \leq x, y, z \leq 10^9.

Output

Output numbers: for each point, print the index (from to ) of its nearest point.

Examples

Example 1

Loading
Loading