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:
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define owo(i,a, b) for(int i=(a);i<(b); ++i)
#define uwu(i,a, b) for(int i=(a)-1; i>=(b); --i)
#define senpai push_back
#define ttgl pair<int, int>
#define ayaya cout<<"ayaya~"<<endl
 
using namespace std;
using ll = long long;
using ld = long double;
ll MOD = 1000000007;
const ll root = 3;
ll binpow(ll a,ll b){ll res=1;while(b){if(b&1)res=(res*a)%MOD;a=(a*a)%MOD;b>>=1;}return res;}
ll modInv(ll a){return binpow(a, MOD-2);}
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxN = 2001;
int n;
vector<ttgl> res;
int ord[mxN];
int lab[mxN];
int dsu[mxN];
int bck[mxN];
struct pt {
    ll x, y;
    pt(ll x = 0, ll y = 0) : x(x), y(y) {}
    bool operator < (const pt &o) const {
        return (x == o.x ? y < o.y : x < o.x);
    }
    pt operator - (const pt &o) const {
        return pt(x - o.x, y - o.y);
    }
}arr[mxN];
int half(pt x) { return x.y == 0 ? x.x < 0 : x.y > 0; } 
ll cross(pt a, pt b) {
    return a.x * b.y - a.y * b.x;
}
bool angsort(pt a, pt b) {
	int A = half(a), B = half(b);
	return A == B ? cross(a,b) > 0 : A < B; 
}
int find(int a) {
    return a==dsu[a] ? a : dsu[a] = find(dsu[a]);
}
bool merge(int a, int b) {
    a = find(a);
    b = find(b);
    if(a==b)return 0;
    dsu[b] = a;
    return 1;
}
int main() {
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    cin.tie(0)->sync_with_stdio(0);
    cin>>n;
    iota(dsu, dsu+mxN, 0);
    owo(i, 0, n) {
        cin>>arr[i].x>>arr[i].y>>lab[i];
        lab[i]--;
        merge(i, lab[i]);
    }
    iota(ord, ord+n, 0);
    sort(ord, ord+n, [&](int a, int b) {
        return arr[a] < arr[b];
    });
    int rt = 0;
    owo(_, 0, n) {
        int i = ord[_];
        if(lab[i]==i)continue;
        rt = i;
        vector<int> nord;
        owo(j, 0, n) {
            if(i!=j)nord.senpai(j);
        }
        sort(nord.begin(), nord.end(), [&](int a, int b) {
            return angsort(arr[a] - arr[i], arr[b] - arr[i]);
        });
        owo(j, 1, n-1) {
            if(merge(nord[j], nord[j-1])) {
                res.senpai({nord[j], nord[j-1]});
                swap(lab[nord[j]], lab[nord[j-1]]);
            }
        }
        int curr = lab[i];
        while(curr!=i) {
            res.senpai({i, curr});
            curr = lab[curr];
        }
        break;
    }
    /*if(res.size() > 0 && res[0].first==394) {
        cout<<rt<<"\n";
        int a = res[384].first;
        int b = res[384].second;
        cout<<a<<" "<<b<<" "<<arr[a].x<<" "<<arr[a].y<<" "<<arr[b].x<<" "<<arr[b].y<<"\n";
        a = res[463].first;
        b = res[463].second;
        cout<<a<<" "<<b<<" "<<arr[a].x<<" "<<arr[a].y<<" "<<arr[b].x<<" "<<arr[b].y<<"\n";
    }*/
    cout<<res.size()<<"\n";
    for(auto p: res) {
        cout<<p.first+1<<" "<<p.second+1<<"\n";
    }
    return 0;
}