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>

#define debug(...) fprintf(stderr ,__VA_ARGS__)
#define __FILE(x)\
	freopen(#x".in" ,"r" ,stdin);\
	freopen(#x".out" ,"w" ,stdout)
#define LL long long

const int MX = 2000 + 23;
const LL MOD = 998244353;

int read(){
	char k = getchar(); int x = 0 ,flg = 1;
	while(k < '0' || k > '9') flg *= k == '-' ? -1 : 1 ,k = getchar();
	while(k >= '0' && k <= '9') x = x * 10 + k - '0' ,k = getchar();
	return x * flg;
}

int n ,fa[MX] ,sz[MX];
void init(){for(int i = 0 ; i < MX ; ++i) fa[i] = i ,sz[i] = 1;}
int find(int x){return fa[x] == x ? x : fa[x] = find(fa[x]);}
void link(int x ,int y){
	x = find(x) ,y = find(y);
	if(x == y) return;
	fa[x] = y ,sz[y] += sz[x];
}

struct VECTOR{
	int x ,y;
	VECTOR(int xx ,int yy){x = xx ,y = yy;}
	VECTOR(){x = y = 0;}
	VECTOR operator +(const VECTOR& B)const{return VECTOR(x + B.x ,y + B.y);}
	VECTOR operator -(const VECTOR& B)const{return VECTOR(x - B.x ,y - B.y);}
	LL operator *(const VECTOR &B)const{return 1LL * x * B.y - 1LL * y * B.x;}
	bool operator ==(const VECTOR &B)const{return x == B.x && y == B.y;}
};

LL dist(VECTOR A ,VECTOR B){
	#define p(x) ((x) * (x))
	return p(0LL + A.x - B.x) + p(0LL + A.y - B.y);
}

struct POINT{
	VECTOR c;
	int id;
}A[MX];

int quadrant(VECTOR A){
	if(A.x >= 0 && A.y >= 0) return 1;
	if(A.x <= 0 && A.y >= 0) return 2;
	if(A.x <= 0 && A.y <= 0) return 3;
	if(A.x >= 0 && A.y <= 0) return 4;
	return 0;
}

VECTOR BASE;
bool cmp(VECTOR A ,VECTOR B){
	if(B == BASE) return 0;
	if(A == BASE) return 1;
	LL crs = (A - BASE) * (B - BASE);
	return crs > 0;
}

bool cmpp(POINT A ,POINT B){
	if(sz[find(A.id)] == 1) return 0;
	if(sz[find(B.id)] == 1) return 1;
	return cmp(A.c ,B.c);
}

int p[MX];

std::vector<int> op1 ,op2;
void pushans(int x ,int y){
	op1.push_back(x);
	op2.push_back(y);
}

void outans(){
	printf("%lu\n" ,op1.size());
	for(int i = 0 ; i < (int)op1.size() ; ++i)
		printf("%d %d\n" ,op1[i] ,op2[i]);
	exit(0);
}

int main(){
	init();

	n = read();

	BASE = VECTOR(1e9 ,1e9);
	for(int i = 1 ,x ,y ; i <= n ; ++i){
		x = read() ,y = read() ,p[i] = read();
		A[i] = (POINT){VECTOR(x ,y) ,i};
		link(i ,p[i]);
	}
	for(int i = 1 ; i <= n ; ++i){
		if(sz[find(i)] != 1){
			if(A[i].c.x < BASE.x) BASE = A[i].c;
			break;
		}	
	}

	if(BASE.x == 1e9){
		outans();
		return 0;
	}

	std::sort(A + 1 ,A + 1 + n ,cmpp);

	int las = 0;
	for(int i = 2 ; i <= n ; ++i){
		if(sz[find(A[i].id)] != 1){
			if(las){
				int x = A[i].id ,y = A[las].id;
				if(find(x) != find(y)){
					link(x ,y);
					std::swap(p[x] ,p[y]);
					pushans(x ,y);
				}
			}
			las = i;
		}
	}

	int x = p[A[1].id];
	while(x != A[1].id){
		pushans(A[1].id ,x);
		x = p[x];
	}

	outans();

	return 0;
}