Under construction

Still being built. Things may change

Banach

Time limit3sMemory limit512 MB

Summary
Assign N vectors to N points so that no pairwise distance shrinks after translation, maximizing the sum of squared pairwise distances.
Level

Hard8 of 10

Topics
Geometry, Math
Solved
No attempts yet

Problem

Stefan, David and Felix are preparing an ACM-style programming contest. Stefan proposes the following task.

Given NN points on a plane and NN movement vectors, find a one-to-one correspondence between vectors and points such that, if each point is translated by its corresponding vector, the distance between every pair of points does not decrease.

David solved this problem quickly and claims it is too easy to include in the problem set. To convince him, Felix proposes an update. Among all valid solutions, choose the one that maximizes the sum of squares of all resulting pairwise distances.

David still thinks the problem is easy. Do you agree?

Input

The first line contains a single integer NN, the number of points and vectors (1≤N≤5001 \leq N \leq 500).

The next NN lines describe the points. Each line contains two integers pxipx_i and pyipy_i (0≤∣pxi∣,∣pyi∣≤10 0000 \leq |px_i|, |py_i| \leq 10\,000).

The following NN lines describe the vectors. Each line contains two integers vxivx_i and vyivy_i (0≤∣vxi∣,∣vyi∣≤10 0000 \leq |vx_i|, |vy_i| \leq 10\,000).

Output

If a correspondence exists such that all pairwise distances do not decrease, print Yes on the first line. On the next line, print NN distinct integers from 11 to NN, where the ii-th number is the vector assigned to the ii-th point.

The answer must maximize the sum of squares of all resulting pairwise distances. If several answers tie, print any of them.

If no such correspondence exists, print No on a single line.

Hint

In the first example, there are only two correspondences, "1 2" and "2 1". In both, the distance between every pair of points does not decrease. The sum of squares is 9 for the first and 25 for the second, so the only correct answer is "2 1".

In the second example, there are again only two correspondences. Both keep every pairwise distance, and the sum of squares is 0 in both cases, so either answer is correct.

Examples3

  1. Example 1

    Input
    2
    0 0
    1 0
    2 0
    -2 0
    
    Expected output
    Yes
    2 1
    
  2. Example 2

    Input
    2
    2 2
    2 2
    -1 -1
    -1 -1
    
    Expected output
    Yes
    1 2
    
  3. Example 3

    Input
    3
    -2 -3
    3 1
    -3 -3
    -3 5
    -2 -4
    4 -1
    
    Expected output
    Yes
    2 3 1