Problem: Based on a peculiar incident at basketball practice, Akari came up with the following competitive programming problem!

You are given n points on the plane, no three of which are collinear. The i-th point initially has a label a_i, in such a way that the labels a_1, a_2, ..., a_n form a permutation of 1, 2, ..., n.

You are allowed to modify the labels through the following operation:

  1. Choose two distinct integers i and j between 1 and n. 
  2. Swap the labels of points i and j, and finally 
  3. Draw the segment between points i and j. 



A sequence of operations is valid if after applying all of the operations in the sequence in order, the k-th point ends up having the label k for all k between 1 and n inclusive, and the drawn segments don't intersect each other internally. Formally, if two of the segments intersect, then they must do so at a common endpoint of both segments.

In particular, all drawn segments must be distinct.

Find any valid sequence of operations, or say that none exist. 

Input

The first line contains an integer n (3 ≤ n ≤ 2000) — the number of points.

The i-th of the following n lines contains three integers x_i, y_i, a_i (-10^6 ≤ x_i, y_i ≤ 10^6, 1 ≤ a_i ≤ n), representing that the i-th point has coordinates (x_i, y_i) and initially has label a_i.

It is guaranteed that all points are distinct, no three points are collinear, and the labels a_1, a_2, ..., a_n form a permutation of 1, 2, ..., n.

Output

If it is impossible to perform a valid sequence of operations, print -1.

Otherwise, print an integer k (0 ≤ k ≤ (n(n - 1))/(2)) — the number of operations to perform, followed by k lines, each containing two integers i and j (1 ≤ i, j ≤ n, i≠ j) — the indices of the points chosen for the operation.

Note that you are not required to minimize or maximize the value of k.

If there are multiple possible answers, you may print any of them.

Examples

Input


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


Output


5
1 2
5 3
4 5
1 5
1 3


Input


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


Output


0

Note

The following animation showcases the first sample test case. The black numbers represent the indices of the points, while the boxed orange numbers represent their labels.

<image>

In the second test case, all labels are already in their correct positions, so no operations are necessary.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;

const int N = 2005;

struct Point {
  int id, x, y, col, a;
} p[N];

int n, a[N], cnt, fa[N];

bool cmp(Point a, Point b) {
  if ((a.x > 0) != (b.x > 0)) return (a.x > 0) > (b.x > 0);
  return 1ll * a.y * b.x < 1ll * b.y * a.x;
}

int find(int x) {
  if (fa[x] == x) return x;
  return fa[x] = find(fa[x]);
}

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d", &p[i].x, &p[i].y, &p[i].a);
    p[i].id = i;
  }
  
//  if (n == 2000) {
//    for (int i = 1; i <= n; i++) {
//      if (i == 1345) printf("x[%d] = %d, y[%d] = %d\n", i, x[i], i, y[i]);
//      if (i == 175) printf("x[%d] = %d, y[%d] = %d\n", i, x[i], i, y[i]);
//      if (i == 1699) printf("x[%d] = %d, y[%d] = %d\n", i, x[i], i, y[i]);
//      if (i == 1422) printf("x[%d] = %d, y[%d] = %d\n", i, x[i], i, y[i]);
//    }
//  }
  
  for (int i = 1; i <= n; i++) {
    if (!p[i].col) {
      ++cnt;
      for (int u = i; !p[u].col; u = p[u].a) {
        p[u].col = cnt;
      }
    }
  }
  if (p[1].a == 1) {
    bool flag = false;
    for (int i = 2; i <= n; i++) {
      if (p[i].a != i) {
        swap(p[i], p[1]);
        flag = true;
        break;
      }
    }
    if (!flag) {
      puts("0");
      return 0;
    }
  }
  
  for (int i = 2; i <= n; i++) {
    p[i].x -= p[1].x;
    p[i].y -= p[1].y;
  }
  
//  for (int i = 1; i <= n; i++) {
//    printf("x[%d] = %d, y[%d] = %d\n", i, p[i].x, i, p[i].y);
//  }
  
  sort(p + 2, p + n + 1, cmp);
  
//  for (int i = 1; i <= n; i++) {
//    printf("x[%d] = %d, y[%d] = %d\n", i, p[i].x, i, p[i].y);
//  }
  
  vector<pair<int, int> > v1, v2;
  for (int i = 1; i <= cnt; i++) {
    fa[i] = i;
  }
  for (int i = 2; i <= n; i++) {
    int j = (i == n ? 2 : i + 1);
    
    if (1ll * p[i].y * p[j].x > 1ll * p[i].x * p[j].y) {
      continue;
    }
    
    if (find(p[i].col) != find(p[j].col)) {
      v1.push_back(make_pair(p[i].id, p[j].id));
      fa[find(p[i].col)] = find(p[j].col);
      swap(p[i].a, p[j].a);
    }
  }
  int k = p[1].id;
  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= n; j++) {
      if (p[j].a == k) {
        v2.push_back(make_pair(p[1].id, p[j].id));
        k = p[j].id; break;
      }
    }
  }
  printf("%d\n", (int) v1.size() + (int) v2.size());
  for (auto p : v1) {
    printf("%d %d\n", p.first, p.second);
  }
  reverse(v2.begin(), v2.end());
  for (auto p : v2) {
    printf("%d %d\n", p.first, p.second);
  }
  return 0;
}