Problem: Now that Heidi knows that she can assign Rebel spaceships to bases (recall the easy subtask), she is asking you: how exactly to do this? Now, given positions of N spaceships and N bases on a plane, your task is to connect spaceships and bases with line segments so that: 

  * The segments do not intersect. 
  * Such a connection forms a perfect matching. 

Input

The first line contains an integer N (1 ≤ n ≤ 10000). For 1 ≤ i ≤ N, the i + 1-th line contains two integers xi and yi (|xi|, |yi| ≤ 10000) denoting the coordinates of the i-th spaceship. The following N lines have the same format, denoting the position of bases. It is guaranteed that no two points coincide and no three points are on the same line.

Output

The output should have N lines. The i-th line should contain an integer pi, the index of the base to which the i-th spaceship is connected. The sequence p1, ..., pN should form a permutation of 1, ..., N.

It is guaranteed that a solution exists. If there are multiple solutions, you can output any one of them.

Example

Input

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


Output

4
1
2
3

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
FILE *fin = fopen("pairs.in", "r");
FILE *fout = fopen("pairs.out", "w");
int divisor;
struct point {
  int x, y;
  int ind;
  inline point() {}
  inline point(int _x, int _y) {
    x = _x;
    y = _y;
  }
  inline int color() { return ind < divisor ? 1 : -1; }
};
bool operator<(point a, point b) {
  return (a.x == b.x && a.y < b.y) || (a.x < b.x);
}
point operator-(point a, point b) { return point(a.x - b.x, a.y - b.y); }
long long cprod(point a, point b) { return a.x * b.y - a.y * b.x; }
long long dprod(point a, point b) { return a.x * b.x + a.y * b.y; }
vector<point> read_data() {
  vector<point> p;
  int n;
  scanf("%d", &n);
  divisor = n;
  n *= 2;
  p.resize(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &p[i].x, &p[i].y);
    p[i].ind = i;
  }
  return p;
}
void write_answer(vector<pair<int, int> > &pairs) {
  vector<int> a;
  a.resize(pairs.size());
  for (int i = 0; i < pairs.size(); ++i) {
    if (pairs[i].first >= pairs.size()) swap(pairs[i].first, pairs[i].second);
    a[pairs[i].first + 1 - 1] = pairs[i].second + 1 - pairs.size();
  }
  for (int i = 0; i < pairs.size(); i++) cout << a[i] << ' ';
}
vector<pair<int, int> > solve_low_high(vector<point> &points) {
  int n = points.size();
  vector<bool> colored(n, 0);
  queue<pair<int, int> > problems;
  vector<pair<int, int> > pairs;
  problems.push(make_pair(0, n));
  while (!problems.empty()) {
    int l = problems.front().first;
    int r = problems.front().second;
    vector<int> hup, hdown;
    for (int i = l; i < r; ++i)
      if (!colored[i]) {
        while (hup.size() >= 2 && cprod(points[i] - points[hup[hup.size() - 2]],
                                        points[hup[hup.size() - 1]] -
                                            points[hup[hup.size() - 2]]) >= 0)
          hup.pop_back();
        hup.push_back(i);
      }
    for (int i = l; i < r; ++i)
      if (!colored[i]) {
        while (hdown.size() >= 2 &&
               cprod(points[i] - points[hdown[hdown.size() - 2]],
                     points[hdown[hdown.size() - 1]] -
                         points[hdown[hdown.size() - 2]]) <= 0)
          hdown.pop_back();
        hdown.push_back(i);
      }
    bool found = false;
    for (int i = 0; i + 1 < hup.size(); ++i)
      if (!colored[hup[i]] && !colored[hup[i + 1]] &&
          points[hup[i]].color() * points[hup[i + 1]].color() < 0) {
        found = true;
        colored[hup[i]] = true;
        colored[hup[i + 1]] = true;
        pairs.push_back(make_pair(points[hup[i]].ind, points[hup[i + 1]].ind));
      }
    for (int i = 0; i + 1 < hdown.size(); ++i)
      if (!colored[hdown[i]] && !colored[hdown[i + 1]] &&
          points[hdown[i]].color() * points[hdown[i + 1]].color() < 0) {
        found = true;
        colored[hdown[i]] = true;
        colored[hdown[i + 1]] = true;
        pairs.push_back(
            make_pair(points[hdown[i]].ind, points[hdown[i + 1]].ind));
      }
    if (hup.size() > 0 && hdown.size() > 0 && hup.back() != hdown.back() &&
        !colored[hup.back()] && !colored[hdown.back()] &&
        points[hup.back()].color() * points[hdown.back()].color() < 0) {
      found = true;
      colored[hup.back()] = true;
      colored[hdown.back()] = true;
      pairs.push_back(
          make_pair(points[hup.back()].ind, points[hdown.back()].ind));
    }
    if (!found) {
      problems.pop();
      int sum = 0;
      int d = -1;
      for (int i = l; i < r; ++i)
        if (!colored[i]) {
          sum += points[i].color();
          if (sum == 0) {
            d = i + 1;
            break;
          }
        }
      if (d != -1) {
        assert(sum == 0);
        if (d > l) problems.push(make_pair(l, d));
        if (r > d) problems.push(make_pair(d, r));
      }
    }
  }
  return pairs;
}
int main(int argc, char *const argv[]) {
  vector<point> data = read_data();
  sort(data.begin(), data.end());
  vector<pair<int, int> > pairs = solve_low_high(data);
  write_answer(pairs);
  return 0;
}