Problem: A set of points on a plane is called good, if for any two points at least one of the three conditions is true:

  * those two points lie on same horizontal line; 
  * those two points lie on same vertical line; 
  * the rectangle, with corners in these two points, contains inside or on its borders at least one point of the set, other than these two. We mean here a rectangle with sides parallel to coordinates' axes, the so-called bounding box of the two points.



You are given a set consisting of n points on a plane. Find any good superset of the given set whose size would not exceed 2·105 points.

Input

The first line contains an integer n (1 ≤ n ≤ 104) — the number of points in the initial set. Next n lines describe the set's points. Each line contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — a corresponding point's coordinates. It is guaranteed that all the points are different.

Output

Print on the first line the number of points m (n ≤ m ≤ 2·105) in a good superset, print on next m lines the points. The absolute value of the points' coordinates should not exceed 109. Note that you should not minimize m, it is enough to find any good superset of the given set, whose size does not exceed 2·105.

All points in the superset should have integer coordinates.

Examples

Input

2
1 1
2 2


Output

3
1 1
2 2
1 2

Solution (in JAVA):

Solution:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Arrays;
import java.util.Comparator;
import java.util.TreeSet;

public class B {
    private static StreamTokenizer in;
    private static PrintWriter out;
    private static BufferedReader inB;
    
    private static int nextInt() throws Exception{
        in.nextToken();
        return (int)in.nval;
    }
    
    private static String nextString() throws Exception{
        in.nextToken();
        return in.sval;
    }
    
    static{
        in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        inB = (new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(System.out);
    }

//  private static HashSet<Mas> newp = new HashSet<Mas>();
    private static TreeSet<Mas> newp = new TreeSet<Mas>();
    
    private static int n;
    private static int[][] mas;
    
    
    
    public static void main(String[] args)throws Exception{

//      Integer[] g = new Integer[] {2, 3, 1, 4};
//      
//      Arrays.sort(g, new Comparator<Integer>() {
//
//          @Override
//          public int compare(Integer i1, Integer i2) {
//              // TODO Auto-generated method stub
//              return i1 < i2 ? 1 : ( i1 == i2 ? 0 : -1 );
//          }
//          
//      });
//      
//      for(int i = 0; i<g.length; i++)System.out.print(g[i] + " ");
//      System.out.println();
        
        n = nextInt();
        mas = new int[n][2];
        
        for(int i = 0; i<n; i++) {
            mas[i][0] = nextInt();
            mas[i][1] = nextInt();
        }
        
        Arrays.sort(mas, new Comparator<int[]>() {
            public int compare(int[] mas1, int[] mas2) {
                return mas1[0] > mas2[0] ? 1 : ( mas1[0] == mas2[0] ? 0 : -1 );
            }
        });
        
        

        
        f(0, n);
        
        for(int i = 0; i<n; i++) {
            Mas cur = new Mas(mas[i][0], mas[i][1]);
            if(!newp.contains(cur))newp.add(cur);
        }
        
        out.println(newp.size());
        

        for(Mas m : newp) {
            out.println(m.mas[0] + " " + m.mas[1]);
        }
        
        out.flush();
    }
    
    private static void f(int l, int r) {
        int col = r - l;
        
        if(col < 2)return;
        
        int countLeft = 0;
        int countCur = 0; 
        int mind = Integer.MAX_VALUE; int mindx = -1; int mindind = -1; int mindindEnd = -1;
        for(int i = l; i<r; i++) {
            int cur = mas[i][0];
            int curEnd=0;
            for(int j = i; j<r; j++) {
                if(mas[j][0] != cur)break;
                countCur++;
            }
            curEnd = i + countCur;
            
            int raz = Math.abs((col - countCur - countLeft) - countLeft);
            
            if(raz < mind) {
                mind = raz;
                mindx = cur;
                mindind = i;
                mindindEnd = curEnd;
            }
            
            i += countCur - 1;
            countLeft += countCur;
            countCur = 0;
        }
        
        f(l, mindind);
        f(mindindEnd, r);
        
        for(int i = l; i<r; i++) {
//          if(mas[1][i] != mindx)newp.add(new int[] {mindx, mas[1][i]});
            if(mas[i][0] != mindx)newp.add(new Mas(mindx, mas[i][1]));
        }
    }
}

class Mas implements Comparable {
    public int[] mas;
    
    public Mas(int a, int b) {
        mas = new int[2];
        mas[0] = a; mas[1] = b;
    }
    
//  public boolean equals(Object o) {
//      Mas m = (Mas)o;
//      return m.mas[0] == mas[0] && m.mas[1] == mas[1];
//  }
    
//  public int hashCode() {
//      long ans = ((long)mas[0] * 3571 + mas[1]) % 1000000007;
//      return (int)ans;
//  }

    @Override
    public int compareTo(Object arg0) {
        // TODO Auto-generated method stub
        Mas m = (Mas)arg0;
        return mas[0] == m.mas[0] ? (mas[1] == m.mas[1] ? 0 : (mas[1] < m.mas[1] ? -1 : 1)) : (mas[0] < m.mas[0] ? -1 : 1);
    }
    
}