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 <stdio.h>
#include <string.h>
#include <sys/time.h>

#define N	2000

unsigned int X;

void srand_() {
	struct timeval tv;

	gettimeofday(&tv, NULL);
	X = tv.tv_sec ^ tv.tv_usec;
	if (X % 2 == 0)
		X++;
}

int rand_() {
	return (X *= 3) >> 1;
}

int xx[N], yy[N], o;

long long cross(int i, int j) {
	return (long long) (xx[i] - xx[o]) * (yy[j] - yy[o]) - (long long) (xx[j] - xx[o]) * (yy[i] - yy[o]);
}

int compare(int i, int j) {
	int sgn_i = xx[i] < xx[o] || xx[i] == xx[o] && yy[i] < yy[o] ? -1 : 1;
	int sgn_j = xx[j] < xx[o] || xx[j] == xx[o] && yy[j] < yy[o] ? -1 : 1;
	long long c;

	if (sgn_i != sgn_j)
		return sgn_i - sgn_j;
	c = cross(i, j);
	return c == 0 ? 0 : (c < 0 ? -1 : 1);
}

void sort(int *ii, int l, int r) {
	while (l < r) {
		int i = l, j = l, k = r, i_ = ii[l + rand_() % (r - l)], tmp;

		while (j < k) {
			int c = compare(ii[j], i_);

			if (c == 0)
				j++;
			else if (c < 0) {
				tmp = ii[i], ii[i] = ii[j], ii[j] = tmp;
				i++, j++;
			} else {
				k--;
				tmp = ii[j], ii[j] = ii[k], ii[k] = tmp;
			}
		}
		sort(ii, l, i);
		l = k;
	}
}

int ds[N];

int find(int i) {
	return ds[i] < 0 ? i : (ds[i] = find(ds[i]));
}

void join(int i, int j) {
	i = find(i);
	j = find(j);
	if (i == j)
		return;
	if (ds[i] > ds[j])
		ds[i] = j;
	else {
		if (ds[i] == ds[j])
			ds[i]--;
		ds[j] = i;
	}
}

void rotate(int *ii, int n, int i) {
	static int jj[N];
	int h;

	for (h = 0; h < n; h++)
		jj[h] = ii[(h + i) % n];
	memcpy(ii, jj, n * sizeof *jj);
}

int main() {
	static int pp[N], ii[N], uu[N * 2], vv[N * 2];
	int n, h, i, j, cnt, tmp;

	srand_();
	scanf("%d", &n);
	memset(ds, -1, n * sizeof *ds);
	for (i = 0; i < n; i++) {
		scanf("%d%d%d", &xx[i], &yy[i], &pp[i]), pp[i]--;
		join(i, pp[i]);
	}
	for (o = 0; o < n; o++)
		if (o != pp[o])
			break;
	if (o == n) {
		printf("0\n");
		return 0;
	}
	for (i = 0; i < n; i++)
		ii[i] = i;
	ii[0] = o, ii[o] = 0;
	sort(ii, 1, n);
	for (h = 2; h < n; h++) {
		i = ii[h - 1], j = ii[h];
		if (cross(i, j) > 0) {
			rotate(ii + 1, n - 1, h - 1);
			break;
		}
	}
	cnt = 0;
	for (h = 2; h < n; h++) {
		i = ii[h - 1], j = ii[h];
		if (find(i) != find(j)) {
			join(i, j);
			tmp = pp[i], pp[i] = pp[j], pp[j] = tmp, uu[cnt] = i, vv[cnt] = j, cnt++;
		}
	}
	while ((j = pp[o]) != o)
		tmp = pp[o], pp[o] = pp[j], pp[j] = tmp, uu[cnt] = o, vv[cnt] = j, cnt++;
	printf("%d\n", cnt);
	for (h = 0; h < cnt; h++)
		printf("%d %d\n", uu[h] + 1, vv[h] + 1);
	return 0;
}