Problem: Pasha is a young technician, nevertheless, he has already got a huge goal: to assemble a PC. The first task he has to become familiar with is to assemble an electric scheme.

The scheme Pasha assembled yesterday consists of several wires. Each wire is a segment that connects two points on a plane with integer coordinates within the segment [1, 10^9].

There are wires of two colors in the scheme: 

  * red wires: these wires are horizontal segments, i.e. if such a wire connects two points (x_1, y_1) and (x_2, y_2), then y_1 = y_2; 
  * blue wires: these wires are vertical segments, i.e. if such a wire connects two points (x_1, y_1) and (x_2, y_2), then x_1 = x_2. 



Note that if a wire connects a point to itself, it may be blue, and it can be red. Also, in Pasha's scheme no two wires of the same color intersect, i.e. there are no two wires of same color that have common points.

The imperfection of Pasha's scheme was that the wires were not isolated, so in the points where two wires of different colors intersect, Pasha saw sparks. Pasha wrote down all the points where he saw sparks and obtained a set of n distinct points. After that he disassembled the scheme.

Next morning Pasha looked at the set of n points where he had seen sparks and wondered how many wires had he used. Unfortunately, he does not remember that, so he wonders now what is the smallest number of wires he might have used in the scheme. Help him to determine this number and place the wires in such a way that in the resulting scheme the sparks occur in the same places.

Input

The first line contains a single integer n (1 ≤ n ≤ 1000) — the number of points where Pasha saw sparks.

Each of the next n lines contain two integers x and y (1 ≤ x, y ≤ 10^9) — the coordinates of a point with sparks. It is guaranteed that all points are distinct.

Output

Print the description of the scheme in the following format.

In the first line print h — the number of horizontal red wires (0 ≤ h). In each of the next h lines print 4 integers x_1, y_1, x_2, y_2 — the coordinates of two points (x_1, y_1) and (x_2, y_2) that are connected with this red wire. The segmenst must be horizontal, i.e. y_1 = y_2 must hold. Also, the constraint 1 ≤ x_1, y_1, x_2, y_2 ≤ 10^9 must hold.

After that print v — the number of vertical blue wires (0 ≤ v). In each of the next v lines print 4 integers x_1, y_1, x_2, y_2 — the coordinates of two points (x_1, y_1) and (x_2, y_2) that are connected with this blue wire. The segmenst must be vertical, i.e. x_1 = x_2 shomustuld hold. Also, the constraint 1 ≤ x_1, y_1, x_2, y_2 ≤ 10^9 must hold.

No two segments of the same color should have common points. The set of points where sparks appear should be the same as given in the input.

The number of segments (h + v) should be minimum possible. It's easy to see that the answer always exists. If there are multiple possible answers, print any.

Examples

Input

4
2 2
2 4
4 2
4 4


Output

2
5 2 1 2
1 4 5 4
2
2 1 2 5
4 5 4 1


Input

4
2 1
3 2
2 3
1 2


Output

4
2 1 2 1
3 2 3 2
1 2 1 2
2 3 2 3
3
1 2 1 2
3 2 3 2
2 3 2 1

Note

In the first example Pasha could have assembled the following scheme:

<image>

In this scheme there are 2 wires of each color: red ones connecting (5, 2) with (1, 2) and (1, 4) with (5, 4), blue ones connecting (2, 1) with (2, 5) and (4, 5) with (4, 1). Note that the sparks appear in the points that are described in the input, they are shown in yellow on the picture. For example, Pasha will see the spark in the point (2, 4) because the second red wire and the first blue wire intersect there. It is possible to show that we can't have less than 4 wires to produce a scheme with same sparks positions.

Solution (in JAVA):

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

public class F {

	static class Point {
		int x, y;
		
		boolean stopX, stopY;

		public Point(int x, int y) {
			this.x = x;
			this.y = y;
		}

		int getX() {
			return x;
		}

		void setX(int x) {
			this.x = x;
		}

		int getY() {
			return y;
		}

		void setY(int y) {
			this.y = y;
		}

		@Override
		public String toString() {
			return "(" + x + ", " + y + ")";
		}
	}

	static class Segment {
		Point p, q;

		public Segment(Point p, Point q) {
			this.p = p;
			this.q = q;
		}

		@Override
		public String toString() {
			return p + ", " + q;
		}
	}

	boolean doesIntersect(Segment h, Segment v) {
		return v.p.y < h.p.y && v.q.y > h.p.y && h.p.x < v.p.x && h.q.x > v.q.x;
	}

	void submit() {
		int n = nextInt();
		Point[] a = new Point[n];
		for (int i = 0; i < n; i++) {
			int x = nextInt();
			int y = nextInt();
			a[i] = new Point(x, y);
		}

		Arrays.sort(
				a,
				Comparator.comparingInt(Point::getY).thenComparingInt(
						Point::getX));
		hor = new ArrayList<>();
		for (int i = 0; i < n - 1; i++) {
			if (a[i].y == a[i + 1].y) {
				hor.add(new Segment(a[i], a[i + 1]));
			}
		}

		Arrays.sort(
				a,
				Comparator.comparingInt(Point::getX).thenComparingInt(
						Point::getY));
		ver = new ArrayList<>();
		for (int i = 0; i < n - 1; i++) {
			if (a[i].x == a[i + 1].x) {
				ver.add(new Segment(a[i], a[i + 1]));
			}
		}

		vis = new boolean[hor.size()];
		pair = new int[ver.size()];
		Arrays.fill(pair, -1);

		g = new boolean[hor.size()][ver.size()];
		for (int i = 0; i < hor.size(); i++) {
			for (int j = 0; j < ver.size(); j++) {
				g[i][j] = doesIntersect(hor.get(i), ver.get(j));
			}
		}
		
		for (int i = 0; i < hor.size(); i++) {
			Arrays.fill(vis, false);
			dfs(i);
		}

		boolean[] matched = new boolean[hor.size()];
		for (int i = 0; i < ver.size(); i++) {
			if (pair[i] != -1) {
				matched[pair[i]] = true;
			}
		}

		Arrays.fill(vis, false);
		vis2 = new boolean[ver.size()];
		Arrays.fill(vis2, false);

		for (int i = 0; i < hor.size(); i++) {
			if (!matched[i]) {
				dfs2(i);
			}
		}

		
		int ans1 = n;
		
		for (int i = 0; i < hor.size(); i++) {
			if (vis[i]) {
//				System.err.println(hor.get(i));
				hor.get(i).p.stopX = true;
				ans1--;
			}
		}

		int ans2 = n;
		for (int i = 0; i < ver.size(); i++) {
			if (!vis2[i]) {
//				System.err.println(ver.get(i));
				ans2--;
				ver.get(i).p.stopY = true;
			}
		}
		
		Arrays.sort(
				a,
				Comparator.comparingInt(Point::getY).thenComparingInt(
						Point::getX));
		out.println(ans1);
		Point from = null;
		for (Point p : a) {
			if (from == null) {
				from = p;
			}
			if (!p.stopX) {
				out.println(from.x + " " + from.y + " " + p.x + " " + p.y);
				from = null;
			}
		}
		
		out.println(ans2);
		
		Arrays.sort(
				a,
				Comparator.comparingInt(Point::getX).thenComparingInt(
						Point::getY));
		ver = new ArrayList<>();
		for (int i = 0; i < n - 1; i++) {
			if (a[i].x == a[i + 1].x) {
				ver.add(new Segment(a[i], a[i + 1]));
			}
		}
		
		from = null;
		for (Point p : a) {
			if (from == null) {
				from = p;
			}
			if (!p.stopY) {
				out.println(from.x + " " + from.y + " " + p.x + " " + p.y);
				from = null;
			}
		}

	}
	
	boolean[][] g;

	void dfs2(int v) {
		vis[v] = true;
		for (int u = 0; u < ver.size(); u++) {
			if (!g[v][u]) {
				continue;
			}
			if (pair[u] == v) {
				continue;
			}
			if (vis2[u]) {
				continue;
			}
			vis2[u] = true;
			dfs2(pair[u]);
		}
	}

	ArrayList<Segment> hor, ver;

	boolean dfs(int v) {
		vis[v] = true;
		for (int u = 0; u < ver.size(); u++) {
			if (!g[v][u]) {
				continue;
			}
			if (pair[u] == -1 || (!vis[pair[u]] && dfs(pair[u]))) {
				pair[u] = v;
				return true;
			}
		}
		return false;
	}

	boolean[] vis, vis2;
	int[] pair;

	void test() {

	}

	void stress() {
		for (int tst = 0;; tst++) {
			if (false) {
				throw new AssertionError();
			}
			System.err.println(tst);
		}
	}

	F() throws IOException {
		is = System.in;
		out = new PrintWriter(System.out);
		submit();
		// stress();
		// test();
		out.close();
	}

	static final Random rng = new Random();
	static final int C = 5;

	static int rand(int l, int r) {
		return l + rng.nextInt(r - l + 1);
	}

	public static void main(String[] args) throws IOException {
		new F();
	}

	private InputStream is;
	PrintWriter out;

	private byte[] buf = new byte[1 << 14];
	private int bufSz = 0, bufPtr = 0;

	private int readByte() {
		if (bufSz == -1)
			throw new RuntimeException("Reading past EOF");
		if (bufPtr >= bufSz) {
			bufPtr = 0;
			try {
				bufSz = is.read(buf);
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
			if (bufSz <= 0)
				return -1;
		}
		return buf[bufPtr++];
	}

	private boolean isTrash(int c) {
		return c < 33 || c > 126;
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isTrash(b))
			;
		return b;
	}

	String nextToken() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!isTrash(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	String nextString() {
		int b = readByte();
		StringBuilder sb = new StringBuilder();
		while (!isTrash(b) || b == ' ') {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}

	char nextChar() {
		return (char) skip();
	}

	int nextInt() {
		int ret = 0;
		int b = skip();
		if (b != '-' && (b < '0' || b > '9')) {
			throw new InputMismatchException();
		}
		boolean neg = false;
		if (b == '-') {
			neg = true;
			b = readByte();
		}
		while (true) {
			if (b >= '0' && b <= '9') {
				ret = ret * 10 + (b - '0');
			} else {
				if (b != -1 && !isTrash(b)) {
					throw new InputMismatchException();
				}
				return neg ? -ret : ret;
			}
			b = readByte();
		}
	}

	long nextLong() {
		long ret = 0;
		int b = skip();
		if (b != '-' && (b < '0' || b > '9')) {
			throw new InputMismatchException();
		}
		boolean neg = false;
		if (b == '-') {
			neg = true;
			b = readByte();
		}
		while (true) {
			if (b >= '0' && b <= '9') {
				ret = ret * 10 + (b - '0');
			} else {
				if (b != -1 && !isTrash(b)) {
					throw new InputMismatchException();
				}
				return neg ? -ret : ret;
			}
			b = readByte();
		}
	}
}