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 pb push_back
#define x first
#define y second
#define pdd pair<double,double>
#define pii pair<int,int>
#define pll pair<LL,LL>
#define mp make_pair
#define LL long long
#define ULL unsigned long long
#define sqr(x) ((x)*(x))
#define pi acosl(-1)
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
using namespace std;
LL cross(LL x1,LL y1,LL x2,LL y2){
    return x1*y2-x2*y1;
}
LL cross(LL x1,LL y1,LL x2,LL y2,LL x3,LL y3){
    return cross(x1-x3,y1-y3,x2-x3,y2-y3);
}
bool inter(LL x1,LL y1, LL x2,LL y2, LL x3,LL y3,LL x4,LL y4){
    if((cross(x2,y2,x3,y3,x1,y1)^cross(x2,y2,x4,y4,x1,y1))>=0)return false;
    if((cross(x3,y3,x1,y1,x4,y4)^cross(x3,y3,x2,y2,x4,y4))>=0)return false;
    return true;
}
int f[2005];
int Find(int x){
    if(f[x]==x)return x;
    return f[x]=Find(f[x]);
}
void solve(){
    int n;
    scanf("%d",&n);
    int x[2005],y[2005],a[2005];
    int ta[2005];
    for(int i = 1;i<=n;i++)f[i]=i;
    for(int i = 1;i<=n;i++){
        scanf("%d %d %d",&x[i],&y[i],&a[i]);
        ta[i]=a[i];
        int x=Find(i),y=Find(a[i]);
        f[x]=y;
    } 
    int st=0;
    for(int i = 1;i<=n;i++){
        if(a[i]!=i){
            st=i;
            break;
        }
    }
    if(st==0){
        printf("0\n");
        for(int i = 1;i<=n;i++){
            assert(a[i]==i);
        }
        return;
    }
    vector<pair<long double,int> > v;
    for(int i = 1;i<=n;i++){
        if(i!=st){
            v.pb(mp(atan2l(y[i]-y[st],x[i]-x[st]),i));
          //  cout<<v.back().x<<endl;
        }    
    }
    sort(v.begin(),v.end());
    vector<pii> ans;
    for(int i = 0;i<v.size();i++){
        int now=v[i].y,ne=v[(i+1)%v.size()].y;
           if(fmod(v[(i+1)%v.size()].x-v[i].x+2*pi,2*pi)>pi)continue;
        int fa=Find(now),fb=Find(ne);
       // printf("%d %d %d %d\n",now,ne,fa,fb);
        if(fa!=fb){
            swap(a[now],a[ne]);
            ans.pb(mp(now,ne));
            f[fa]=fb;
        }
    }
   // printf("%d %d\n",ans.size(),st);
    while(a[st]!=st){
        ans.pb(mp(st,a[st]));
        int xx=a[st];
        swap(a[st],a[xx]);
    }
    printf("%d\n",ans.size());
    for(auto it:ans){
        printf("%d %d\n",it.x,it.y);
        swap(ta[it.x],ta[it.y]);
    }
    for(int i = 1;i<=n;i++){
        assert(ta[i]==i);
    }
}
int main(){
    int t=1;

    while(t--){
        solve();
    }
}
/*
000
011
101
*/