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 N 2000100
#define eps 1e-6
#define ll long long
#define y1 hjkashjk
#define y2 Y25t
using namespace std;
int rt,to[N],ansx[N],ansy[N],fa[N],n,col[N],color,cnt;;
double X[N],Y[N];
struct point{
	double x,y;
};
point operator - (point A,point B){
	return (point){A.x-B.x,A.y-B.y};
}
double cross(point A,point B){
	return A.x*B.y-A.y*B.x;
}
int half(point A){
	if(A.y<0||(A.y==0&&A.x<0))return 1;
	return 0;
}
int dcmp(double x){
	if(fabs(x)<eps)return 0;
	if(x>0)return 1;
	return -1;
}
double dot(point A,point B){
	return A.x*B.y+A.y*B.x;
}
double len(point A){
	return sqrt(A.x*A.x+A.y*A.y);
}
double angle(point A,point B){
	return acos(dot(A,B)/len(A)/len(B));
}
int pd(point A,point B,point C,point D){
	ll D1=cross(B-A,C-A),D2=cross(B-A,D-A);
	ll D3=cross(D-C,A-C),D4=cross(D-C,B-C);
	return dcmp(D1)*dcmp(D2)<0&&dcmp(D3)*dcmp(D4)<0;
}
struct hh{
	double x,y;
	int id;
}fuck[N],edge[N];
bool operator<(hh a,hh b){
	if(rt==a.id)return 0;
	if(rt==b.id)return 1;
	point A=(point){a.x-X[rt],a.y-Y[rt]};
	point B=(point){b.x-X[rt],b.y-Y[rt]};
	if(half(A)!=half(B))return half(A)<half(B);
	return cross(A,B)>0;
}
int find(int x){
	if(!fa[x])return x;
	return fa[x]=find(fa[x]);
}
double k(int x){
	return (double)(edge[x].y-Y[rt])/(double)(edge[x].x-X[rt]);
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		scanf("%lf%lf%d",&fuck[i].x,&fuck[i].y,&to[i]);
		fuck[i].id=i;
		X[i]=fuck[i].x;
		Y[i]=fuck[i].y;
	}
	int ljx=0;
	for(int i=1;i<=n;i++){
		if(to[i]!=i)edge[++ljx]=fuck[i];
	}
	for(int i=1;i<=n;i++){
		if(to[i]!=i){
			rt=i;
			break;
		}
	}
	n=ljx;
	if(!rt){
		puts("0");
		return 0;
	}
	sort(edge+1,edge+1+n);
	for(int i=1;i<=n;i++){
		if(col[edge[i].id])continue;
		int now=edge[i].id;
		color++;
		while(!col[now]){
			col[now]=color;
			now=to[now];
		} 
	}
//	for(int i=1;i<=n;i++){
//		cout<<"check "<<rt<<' '<<edge[i].x-X[rt]<<' '<<edge[i].y-Y[rt]<<' '<<k(i)<<endl;
//	}
	for(int i=1;i<=n;i++){
		if(edge[i].id==rt)continue;
		int now=i,To=(i-2+n)%n+1;
		while(edge[To].id==rt)To=(To-2+n)%n+1; 
		int fx=find(col[edge[now].id]),fy=find(col[edge[To].id]);
		if(fx==fy)continue;
		int flag=1,ffff=0;
		for(int j=1;j<=n;j++){
			if(j==now||j==To)continue;
			point A,B,C,D;
			A=(point){edge[now].x,edge[now].y};
			B=(point){edge[To].x,edge[To].y};
			C=(point){X[rt],Y[rt]};
			D=(point){edge[j].x,edge[j].y};
			if(pd(A,B,C,D))flag=0,ffff=j;
		}
//		if(!flag){
//			if(X[1]==7){
//				printf("ljx %d %d %d\n",now,To,ffff);
//				printf("fuck %.5f %.5f\n",k(now),k(To));
//				printf("fuck2 %.5f %d\n",k(ffff),(to[edge[ffff].id]==ffff));
//				point A,B,C,D;
//				A=(point){edge[now].x,edge[now].y};
//				B=(point){edge[To].x,edge[To].y};
//				C=(point){X[rt],Y[rt]};
//				D=(point){edge[ffff].x,edge[ffff].y};
//				printf("fuckljxfuckfuckfuck!!1 %.0f %.0f\n",cross(B-C,D-C),cross(D-C,A-C));
//			}
//		}
		if(flag){
			ansx[++cnt]=edge[now].id,ansy[cnt]=edge[To].id;
			swap(to[edge[now].id],to[edge[To].id]);
			fa[fy]=fx;
		}
	}
	int now=to[rt];
	while(now!=rt){
		ansx[++cnt]=now,ansy[cnt]=rt;
		now=to[now];
	}
	cout<<cnt<<endl;
	for(int i=1;i<=cnt;i++)printf("%d %d\n",ansx[i],ansy[i]);
}