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 "geodeb.h"
#include <bits/stdc++.h>
using namespace std;

struct Point {
    long long x, y;
};

bool ccw(Point a, Point b) {
    if (!a.y && !b.y) return a.x < b.x;
    return a.x * b.y < a.y * b.x;
}

bool cmp(Point p1, Point p2) {
    if ((p1.y >= 0 && p2.y >= 0) || (p1.y < 0 && p2.y < 0)) {
        return ccw(p1, p2);
    }
    return p1.y > p2.y;
}

long long cross(const Point& A, const Point& B) {
    return A.x * B.y - A.y * B.x;
}

// cross(CA, CB) < 0: CA -> turns right -> CB
long long cross(const Point&A, const Point& B, const Point& C) {
    Point D = {A.x - C.x, A.y - C.y};
    Point E = {B.x - C.x, B.y - C.y};
    return cross(D, E);
}

bool intersect(Point a, Point b, Point c, Point d) {
    return cross(b, c, a) * cross(b, d, a) < 0 and
        cross(d, a, c) * cross(d, b, c) < 0;
}

int a[2005], vs[2005], cycleInd[2005], merged[2005];
vector<int> cycle[2005];
Point pts[2005];

void dfs(int u, int c) {
    if (vs[u]) return;
    vs[u] = 1;
    cycle[c].push_back(u);
    cycleInd[u] = c;

    dfs(a[u], c);
}
    
vector<pair<int, int>> operations;
void doSwap(int i, int j) {
    swap(a[i], a[j]);
    operations.push_back({i, j});
    // cout << i << " " << j << endl;
    //GD_SEGMENT(pts[i].x, pts[i].y, pts[j].x, pts[j].y);
}

int main() {
    //GD_INIT("output.html");
    // freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    int center = 0;
    for (int i = 1; i <= n; i++) {
        cin >> pts[i].x >> pts[i].y >> a[i];
        //GD_POINT(pts[i].x, pts[i].y);
        //GD_PAUSE();
    }

    int numCycles = 0;
    for (int i = 1; i <= n; i++) {
        if (vs[i] || a[i] == i) continue;
        dfs(i, ++numCycles);
    }
    if (numCycles == 0) {
        cout << 0;
        return 0;
    }
    
    center = cycle[1][0];
    //GD_POINT(pts[center].x, pts[center].y, "red");

    vector<int> index;
    for (int i = 1; i <= numCycles; i++) {
        for (auto j: cycle[i]) {
            // cout << j << " ";
            if (j != center) index.push_back(j);
        }
        // cout << endl;
    }

    sort(index.begin(), index.end(), [&](int i, int j) {
        Point A = {pts[i].x - pts[center].x, pts[i].y - pts[center].y};
        Point B = {pts[j].x - pts[center].x, pts[j].y - pts[center].y};
        return cmp(A, B);
    });

    int turnPoint = -1;
    for (int i = 0; i + 1 < index.size(); i++) {
        if (cross(pts[index[i]], pts[index[i + 1]], pts[center]) > 0) {
            turnPoint = i;
        }
    }
    if (turnPoint != -1) {
        rotate(index.begin(), index.begin() + turnPoint + 1, index.end());
    }
    // cout << endl;

    int start = cycle[1][1];
    merged[1] = 1;

    int pos;
    for (int i = 0; i < index.size(); i++) {
        //GD_POINT(pts[index[i]].x, pts[index[i]].y, "blue");
        if (start == index[i]) pos = i;
    }

    for (int i = pos - 1; i >= 0; i--) {
        if (!merged[cycleInd[index[i]]]) {
            doSwap(index[i], index[i + 1]);
            merged[cycleInd[index[i]]] = 1;
        }
    }

    for (int i = pos + 1; i < index.size(); i++) {
        if (!merged[cycleInd[index[i]]]) {
            doSwap(index[i], index[i - 1]);
            merged[cycleInd[index[i]]] = 1;
        }
    }
    // for (int i = 1; i <= n; i++) {
    //     cout << a[i] << " ";
    // }
    // cout << endl;

    while (a[center] != center) {
        doSwap(center, a[center]);
    }
    cout << operations.size() << '\n';
    for (auto i: operations) cout << i.first << " " << i.second << "\n";

    // for (int i = 0; i < operations.size(); i++) {
    //     for (int j = i + 1; j < operations.size(); j++) {
    //         Point a = pts[operations[i].first];
    //         Point b = pts[operations[i].second];
    //         Point c = pts[operations[j].first];
    //         Point d = pts[operations[j].second];
    //         if (intersect(a, b, c, d)) {
    //             cout << i << " " << j << " BAD" << endl;
    //         }
    //     }
    // }
    return 0;
}