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 fo(a,b,c) for (a=b; a<=c; a++)
#define fd(a,b,c) for (a=b; a>=c; a--)
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
#define ll long long
//#define file
using namespace std;

struct type{int x,y,id; double s;} a[2001];
int n,i,j,k,l,Tot;
int X[2001],Y[2001],A[2001];
int num[2001];
bool bz[2001];
int mn,mn2;
int ans[4000001][2],tot;
int fa[2001];

bool cmp(type a,type b) {return a.s<b.s;}
void add(int x,int y)
{
	++tot;
	ans[tot][0]=x,ans[tot][1]=y;
}
int gf(int t) {if (fa[t]==t) return t; fa[t]=gf(fa[t]);return fa[t];}
void link(int x,int y) {if (gf(x)!=gf(y)) fa[fa[x]]=fa[y];}

int main()
{
	#ifdef file
	freopen("CF1508D.in","r",stdin);
	#endif
	
	scanf("%d",&n);
	fo(i,1,n) scanf("%d%d%d",&X[i],&Y[i],&A[i]),fa[i]=i;
	
	l=0;
	fo(i,1,n)
	if (A[i]!=i && !bz[i])
	{
		++l;j=i;
		while (!bz[j])
		{
			bz[j]=1,num[j]=l;
			a[++Tot]={X[j],Y[j],j};
			j=A[j];
		}
	}
	if (!Tot) {printf("0\n");return 0;}
	
	mn=1000000000,mn2=-1;
	fo(i,1,Tot) if (a[i].y<mn) mn=a[i].y,mn2=i;
	fo(i,1,Tot) if (i!=mn2) a[i]=type{a[i].x-a[mn2].x,a[i].y-a[mn2].y,a[i].id};
	swap(a[mn2],a[Tot]),--Tot;
	fo(i,1,Tot) a[i].s=atan2(a[i].y,a[i].x);
	sort(a+1,a+Tot+1,cmp);
	fo(i,2,Tot)
	if (gf(num[a[i].id])!=gf(num[a[i-1].id]))
	link(num[a[i].id],num[a[i-1].id]),swap(A[a[i].id],A[a[i-1].id]),add(a[i].id,a[i-1].id);
	
	mn2=a[Tot+1].id,i=mn2;
	while (A[i]!=mn2) add(mn2,A[i]),i=A[i];
	
	printf("%d\n",tot);
	fo(i,1,tot) printf("%d %d\n",ans[i][0],ans[i][1]);
	
	fclose(stdin);
	fclose(stdout);
	return 0;
}