#P11574. Manhattan Points Reconstruction

    ID: 13666 Type: Default 1000ms 256MiB

Manhattan Points Reconstruction

Manhattan Points Reconstruction

There are (n) integer points on a plane, but their positions are unknown. You are given (n) pieces of information. The (i)-th piece is of the form (x_i, y_i, t_i), which means that the Manhattan distance from ((x_i,y_i)) to the nearest of the (n) points is (t_i).

Recall that the Manhattan distance between two points ((a,b)) and ((c,d)) is defined as (|a-c|+|b-d|).

Your task is to construct a possible configuration of the (n) points such that for every (i), the minimum Manhattan distance from ((x_i, y_i)) to one of the constructed points is exactly (t_i).

Note: For this problem, we assume that the test cases are such that all (t_i = 0).

inputFormat

The first line contains a single integer (n) denoting the number of points/information lines. Each of the following (n) lines contains three space-separated integers: (x_i), (y_i), and (t_i).

outputFormat

Output (n) lines. The (i)-th line should contain two integers representing the coordinates of the (i)-th point in your constructed configuration. The configuration must satisfy that for each (i), the Manhattan distance from ((x_i,y_i)) to the nearest of the output points is exactly (t_i).

Note: In our test cases, all (t_i = 0), so one valid solution is to output (x_i) and (y_i) as the point coordinates.

sample

3
0 0 0
1 2 0
-3 4 0
0 0

1 2 -3 4

</p>