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 maxn = 2005;
struct node {
	long long x, y, a, idx;
	node(long long _x, long long _y, long long _a, long long _idx)
		: x(_x), y(_y), a(_a), idx(_idx) {}
	node() {}
	void pri() {
		cout << x << ' ' << y << ' ' << a << ' ' << idx << endl;
	}
} nodes[maxn], rnode[maxn];
node g[maxn];
int g_cnt;
node p;

bool cmp(node a, node b) {
	return atan2(a.y - p.y, a.x - p.x) < atan2(b.y - p.y, b.x - p.x);
}

bool check(int a, int b) {
	set< int > S;
	int now = a;
	while (true) {
		S.insert(now);
		node tmp = rnode[now];
		now = tmp.idx;
		if (S.count(now)) {
			break;
		}
	}
	return S.count(b);
}

int ans;
vector< pair< int, int > > V;
void work(int a, int b) {
	node tmp = nodes[a];
	nodes[a].a = nodes[b].a;
	nodes[b].a = tmp.a;
	rnode[nodes[a].a] = nodes[a];
	rnode[nodes[b].a] = nodes[b];
	V.push_back(make_pair(a, b));
}

int main() {
	int n;
	scanf("%d", &n);
	int x, y, a;
	for (int i = 1; i <= n; i++) {
		scanf("%d %d %d", &x, &y, &a);
		nodes[i] = node(x, y, a, i);
		rnode[a] = nodes[i];
		if (a != i) {
			g[++g_cnt] = nodes[i];
		}
	}
	if (g_cnt == 0) {
		puts("0");
		return 0;
	}
	p = g[1];
	// cout << p.x << ' ' << p.y << endl;
	sort(g + 1, g + 1 + g_cnt, cmp);
	g[++g_cnt] = g[1];
	// for (int i = 1; i <= g_cnt; i++) {
	// 	// g[i].pri();
	// 	cout << g[i].x - p.x << ' ' << g[i].y - p.y << ' ' << atan2(g[i].y - p.y, g[i].x - p.x) << endl;
	// }

	for (int i = 1; i < g_cnt; i++) {
		if (g[i].idx != p.idx && g[i + 1].idx != p.idx && !check(g[i].idx, g[i + 1].idx)) {
			// cout << "ttt" << g[i].idx << ' ' << g[i + 1].idx << endl;
			work(g[i].idx, g[i + 1].idx);
		}
	}
	// cout << "*******" << endl;
	// for (int i = 1; i <= g_cnt; i++) {
	// 	int idx = g[i].idx;
	// 	cout << nodes[idx].x << ' ' << nodes[idx].y << ' ' << nodes[idx].a << ' ' << nodes[idx].idx << endl;
	// }

	int idx = p.idx;
	while (true) {
		node tmp = nodes[idx];
		if (tmp.a == idx) {
			break;
		}
		node tmp2 = nodes[tmp.a];

		work(idx, tmp2.idx);
	}
	cout << V.size() << endl;
	for (auto it : V) {
		printf("%d %d\n", it.first, it.second);
	}
	return 0;
}