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 <cassert>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <iomanip>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

struct Vec {
  int x, y;

  Vec(int x = 0, int y = 0) : x(x), y(y) {}

  Vec operator-(const Vec& v) const { return Vec(x - v.x, y - v.y); }

  ll operator*(const Vec& rhs) const { return x * (ll)rhs.y - y * (ll)rhs.x; }

  int region() const {
    if (y > 0 || (y == 0 && x > 0)) return 0;
    return 1;
  }
};

bool cmp(const Vec& lhs, const Vec& rhs) {
  if (lhs.region() != rhs.region()) return lhs.region() < rhs.region();
  return (lhs * rhs) > 0;
}

const int N = 2010;

int x[N], y[N], a[N];
Vec p[N];
int f[N], id[N];

vector<pair<int, int>> ans;

int find(int x) { return f[x] == x ? x : f[x] = find(f[x]); }

void solve() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> x[i] >> y[i] >> a[i];

  int o = 0;
  for (int i = 1; i <= n; ++i) if (a[i] != i) { o = i; break; }
  if (!o) return;

  int m = 0;
  for (int i = 1; i <= n; ++i) if (i != o) p[++m] = Vec(x[i] - x[o], y[i] - y[o]);
  sort(p + 1, p + n, cmp);
  for (int i = 2; i != n; ++i) if (p[i - 1] * p[i] < 0) {
    //cerr << O.x << ' ' << O.y << " -> " << p[i - 1].x << ' ' << p[i - 1].y << ", " << p[i].x << ' ' << p[i].y << '\n';
    rotate(p + 1, p + i, p + n);
    break;
  }
  map<pair<int, int>, int> mp;
  for (int i = 1; i <= n; ++i) mp[make_pair(x[i] - x[o], y[i] - y[o])] = i;
  for (int i = 1; i != n; ++i) id[i] = mp[make_pair(p[i].x, p[i].y)];
  for (int i = 1; i <= n; ++i) {
    if (f[i]) continue;
    int j = i;
    while (!f[j]) {
      f[j] = i;
      j = a[j];
    }
  }
  auto PB = [&](int i, int j) {
    ans.emplace_back(i, j);
    swap(a[i], a[j]);
  };
  for (int r = 2; r != n; ++r) {
    int i = id[r - 1], j = id[r];
    int u = find(i), v = find(j);
    if (u != v) {
      f[u] = v;
      PB(i, j);
    }
  }
  while (a[o] != o) PB(o, a[o]);
}

int main() {
#ifdef ELEGIA
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  solve();
  cout << ans.size() << '\n';
  for (const auto& [i, j] : ans) cout << i << ' ' << j << '\n';

#ifdef ELEGIA
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}