#P5936. [POI 1999 R2] 飞弹

[POI 1999 R2] 飞弹

Background

A war broke out between Country U and Country A.

Problem Description

The chief intelligence officer of Country U learned that Country A has already deployed NN strong bunkers along the border. The defense system formed by these bunkers will pose a huge threat to U's soldiers. Therefore, before launching an attack, U's Ministry of Defense must destroy these bunkers first.

To achieve a surprise attack, the Ministry of Defense decided that each missile launch site on the border will be responsible for eliminating exactly one bunker.

To catch the enemy off guard, the NN missile launch sites will fire at the same time. Each missile moves forward at full speed in a straight line, aiming to deliver a devastating strike to the bunker group in a short time.

However, these missiles use ground-to-ground electronic guidance. If the flight paths of two missiles intersect, their electronic signals will interfere with each other, causing them to deviate from their intended targets.

As a military advisor, you need to design an operation plan: decide in advance which bunker each missile launch site will attack, and make sure that under your plan, the missile flight paths do not intersect.

The intelligence department has clearly marked the positions of the missile launch sites and the bunkers on the map, and guarantees that among these 2N2N points, no three points are collinear.

Input Format

The first line contains an integer NN, the number of missile launch sites, which is also the number of enemy bunkers.

The next NN lines each contain two integers RxiRx_i and Ryi (0Rxi,Ryi104)Ry_i\ (0\le |Rx_i|,|Ry_i|\le 10^4). Line i+1i+1 gives the coordinates of the ii-th missile launch site.

The following NN lines each contain two integers WxiWx_i and Wyi (0Wxi,Wyi104)Wy_i\ (0\le |Wx_i|,|Wy_i|\le 10^4). Line N+i+1N+i+1 gives the coordinates of the ii-th bunker.

Output Format

Output NN lines. The ii-th line contains an integer PiP_i, meaning that the ii-th missile launch site is responsible for destroying the PiP_i-th bunker.

4
0 0
1 5
4 2
2 6
1 2
5 4
4 5
3 1
2
1
4
3

Hint

For 100%100\% of the testdata, 1N100001\le N\le 10000.

Translated by ChatGPT 5