Archery Tournament

Maintain a dynamic set of non-overlapping circles tangent to the ground, support insertions and point queries that remove the hit circle, and report which circle each arrow hits.

Hard8GeometryBinary searchSortingImplementationNo attempts yetTime limit3sMemory limit512 MB

Problem

You were invited to the annual archery tournament, where you compete against the best archers from all of Northern Eurasia. This year the organizers introduced a new format: the shooting range keeps changing, and a new target appears at any moment.

The range is far enough away that you can treat it as a 2D plane whose ground is the line y=0y = 0. Every target is a circle standing on the ground. If a target has center (x,y)(x, y) with y>0y > 0, then its radius equals yy, so the target touches the line y=0y = 0. Two targets that are present at the range at the same time never overlap in their interiors. Their boundaries may touch.

The range is empty at the start. Your part in the tournament is described by nn events. An event either adds a new target to the range or shoots an arrow at one point of the range. To hit a target you must shoot strictly inside its circle. Hitting the border does not count. When your arrow hits a target, that target is removed from the range and you are awarded one point.

Input

The first line contains an integer nn (1n2×1051 \le n \le 2 \times 10^5). The next nn lines describe the events of the tournament in chronological order. The ii-th of these lines contains three integers tit_i, xix_i, yiy_i (ti=1t_i = 1 or ti=2t_i = 2, 109xi,yi109-10^9 \le x_i, y_i \le 10^9, yi>0y_i > 0).

  • If ti=1t_i = 1, a new target with center (xi,yi)(x_i, y_i) and radius yiy_i appears at the range.
  • If ti=2t_i = 2, you shoot an arrow, and the arrow hits the range at the point (xi,yi)(x_i, y_i).

Output

For each of your shots, print one line with a single integer. If the shot hit no target, print -1. If the shot hit a target, print the number of the event that added that target to the range. Events are numbered starting from 1.

Hint

The picture shows the range after the first six events of the example. The rightmost target is hit by the last shot and is about to be removed.