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 JAVA):

Solution:
import java.util.*;
import java.io.*;

public class D1508 {
	public static long cross(int x1, int y1, int x2, int y2) {
		return 1l * x1 * y2 - 1l * x2 * y1;
	}

	public static int compareTo(int x1, int y1, int x2, int y2, int x3, int y3) {
		return Long.compare(cross(x1 - x3, y1 - y3, x2 - x3, y2 - y3), 0);
	}

	public static ArrayList<int[]> solve(int[] root, int[][] nonRoot, int[][] all, UnionFind uf) {
		ArrayList<int[]> ans = new ArrayList<int[]>();
		Arrays.sort(nonRoot, (u, v) -> compareTo(u[0], u[1], v[0], v[1], root[0], root[1]));
		for (int i = 0; i < nonRoot.length; i++) {
			int nxt = (i + 1) % nonRoot.length;
			if (!uf.isSameSet(nonRoot[i][3], nonRoot[nxt][3])) {
				uf.unionSet(nonRoot[i][3], nonRoot[nxt][3]);
				ans.add(new int[] { nonRoot[i][3], nonRoot[(i + 1) % nonRoot.length][3] });
				int temp = nonRoot[i][2];
				nonRoot[i][2] = nonRoot[nxt][2];
				nonRoot[nxt][2] = temp;
			}
		}

		for (int i = 0; i < nonRoot.length; i++) {
			ans.add(new int[] { root[3], root[2] });
			int temp = root[2];
			root[2] = all[temp][2];
			all[temp][2] = temp;
		}

		return ans;
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int n = sc.nextInt();
		int[][] all = new int[n][];
		for (int i = 0; i < all.length; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			int a = sc.nextInt() - 1;
			all[i] = new int[] { x, y, a, i };
		}
		UnionFind uf = new UnionFind(n);
		boolean[] vis = new boolean[n];
		for (int i = 0; i < n; i++) {
			if (vis[i])
				continue;
			int cur = i;
			while (!vis[cur]) {
				vis[cur] = true;
				cur = all[cur][2];
				uf.unionSet(i, cur);
			}
		}
		ArrayList<int[]> ans = new ArrayList<int[]>();
		int rootIdx = -1;
		for (int i = 0; i < n; i++) {
			if (uf.sizeOfSet(i) > 1) {
				if (rootIdx == -1) {
					rootIdx = i;
				} else if (all[rootIdx][0] > all[i][0]) {
					rootIdx = i;
				}
			}
		}
		if (rootIdx != -1) {
			ArrayList<int[]> notRootal = new ArrayList<int[]>();
			for (int j = 0; j < all.length; j++) {
				if (uf.sizeOfSet(j) > 1)
					if (j != rootIdx)
						notRootal.add(all[j]);
			}
			int[][] notRoot = new int[notRootal.size()][];
			for (int i = 0; i < notRootal.size(); i++) {
				notRoot[i] = notRootal.get(i);
			}
			ans = solve(all[rootIdx], notRoot, all, uf);
		}
		pw.println(ans.size());
		for (int[] x : ans) {
			pw.println((x[0] + 1) + " " + (x[1] + 1));
		}
		pw.close();
	}

	static class UnionFind {
		int[] p, rank, setSize;
		int numSets;

		public UnionFind(int N) {
			p = new int[numSets = N];
			rank = new int[N];
			setSize = new int[N];
			for (int i = 0; i < N; i++) {
				p[i] = i;
				setSize[i] = 1;
			}
		}

		public int findSet(int i) {
			return p[i] == i ? i : (p[i] = findSet(p[i]));
		}

		public boolean isSameSet(int i, int j) {
			return findSet(i) == findSet(j);
		}

		public void unionSet(int i, int j) {
			if (isSameSet(i, j))
				return;
			numSets--;
			int x = findSet(i), y = findSet(j);
			if (rank[x] > rank[y]) {
				p[y] = x;
				setSize[x] += setSize[y];
			} else {
				p[x] = y;
				setSize[y] += setSize[x];
				if (rank[x] == rank[y])
					rank[y]++;
			}
		}

		public int numDisjointSets() {
			return numSets;
		}

		public int sizeOfSet(int i) {
			return setSize[findSet(i)];
		}
	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(FileReader f) {
			br = new BufferedReader(f);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = Integer.parseInt(next());
			}
			return arr;
		}

	}

}