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:
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

#define N 300100
#define MOD 1000000007  //998244353
#define EPS (long double)0.000000001
#define PI (long double)3.1415926536
#define ll long long
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
#define eb emplace_back
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define vi vector<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
struct Setup_io {
	Setup_io() {
		ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
		cout << fixed << setprecision(15);
	}
} setup_io;

vector<long double>ax, ay;
vector<pair<long double, int> >b;
int n;
int p[N];
int lef[N];
int righ[N];
bool used[N];
int sz;
long double x, y;
int cent;
int xx;
vector<pii>ans;

void dfs(int cur, int end) {
	bool le = false;
	bool ri = false;
	if (!used[lef[cur]]) {
		xx = lef[cur];
		while (!used[xx]) {
			used[xx] = true;
			xx = p[xx];
		}
		dfs(lef[cur], lef[cur]);
		le = true;
	}
	if (!used[righ[cur]]) {
		xx = righ[cur];
		while (!used[xx]) {
			used[xx] = true;
			xx = p[xx];
		}
		dfs(righ[cur], righ[cur]);
		ri = true;
	}
	ans.pb({ cent,cur });
	if (ri)ans.pb({ cur,righ[cur] });
	if (le)ans.pb({ cur,lef[cur] });
	if (p[cur] == end)return;
	dfs(p[cur], end);
	return;
}



int main() {
	cin >> n;
	rep(i, n)used[i] = false;
	cent = -1;
	rep(i, n) {
		cin >> x >> y;
		cin >> p[i];
		p[i]--;
		if (p[i] != i) {
			if (cent == -1)cent = i;
		}
		else used[i] = true;
		ax.pb(x);
		ay.pb(y);
	}
	if (cent == -1) {
		cout << 0 << endl;
		return 0;
	}
	rep(i, n) {
		if ((!used[i]) && (i != cent)) {
			x = ax[i] - ax[cent];
			y = ay[i] - ay[cent];
			if (abs(x) < EPS) {
				if (y > 0)b.pb({ PI / (2.0),i });
				else b.pb({ PI*(3.0) / (2.0),i });
			}
			else if (abs(y) < EPS) {
				if (x > 0)b.pb({ 0.0,i });
				else b.pb({ PI,i });
			}
			else {
				if ((x > 0) && (y > 0))b.pb({ atan(y / x),i });
				if ((x < 0) && (y > 0))b.pb({ atan(y / x)+PI,i });
				if ((x < 0) && (y < 0))b.pb({ atan(y / x)+PI,i });
				if ((x > 0) && (y < 0))b.pb({ atan(y / x) + (PI*(2.0)),i });
			}
		}
	}
	sort(all(b));
	sz = b.size();
	used[N - 1] = true;
	rep(i, n) {
		lef[i] = N - 1;
		righ[i] = N - 1;
	}
	rep(i, sz - 1) {
		if ((b[i + 1].first - b[i].first) < PI) {
			lef[b[i].second] = b[i + 1].second;
			righ[b[i + 1].second] = b[i].second;
		}
	}
	if ((b[sz - 1].first - b[0].first) > PI) {
		lef[b[sz - 1].second] = b[0].second;
		righ[b[0].second] = b[sz - 1].second;
	}
	xx = cent;
	while (!used[xx]) {
		used[xx] = true;
		xx = p[xx];
	}
	used[N - 1] = true;
	dfs(p[cent], cent);
	sz = ans.size();
	cout << sz << endl;
	rep(i, sz) {
		cout << ans[i].first + 1 << " " << ans[i].second + 1 << endl;
	}

	return 0;
}