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

Solution:
#include <bits/stdc++.h>
using namespace std;
int main() {
  cout.precision(30);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<pair<long long, long long>> ps(n);
  for (int i = 0; i < n; i++) {
    cin >> ps[i].first >> ps[i].second;
  }
  sort(ps.begin(), ps.end(),
       [&](pair<long long, long long> a, pair<long long, long long> b) {
         return make_pair(a.second, a.first) < make_pair(b.second, b.first);
       });
  vector<long long> hadv(n, 0), hadh(n, 0);
  vector<pair<long long, long long>> v, h;
  vector<pair<pair<long long, long long>, pair<long long, long long>>> verts;
  long long cury = ps[0].second;
  for (int i = 1; i < n; i++) {
    if (cury != ps[i].second) {
      cury = ps[i].second;
    } else {
      hadv[i - 1] = 1;
      hadv[i] = 1;
      verts.push_back({ps[i - 1], ps[i]});
    }
  }
  for (int i = 0; i < n; i++) {
    if (!hadv[i]) v.push_back(ps[i]), v.push_back(ps[i]);
  }
  sort(ps.begin(), ps.end());
  vector<pair<pair<long long, long long>, pair<long long, long long>>> hors;
  long long curx = ps[0].first;
  for (int i = 1; i < n; i++) {
    if (curx != ps[i].first) {
      curx = ps[i].first;
    } else {
      hadh[i - 1] = 1;
      hadh[i] = 1;
      hors.push_back({ps[i - 1], ps[i]});
    }
  }
  for (int i = 0; i < n; i++) {
    if (!hadh[i]) h.push_back(ps[i]), h.push_back(ps[i]);
  }
  swap(hors, verts);
  swap(h, v);
  auto inter = [&](pair<long long, long long> a, pair<long long, long long> b,
                   pair<long long, long long> c, pair<long long, long long> d) {
    if (c.first < a.first && a.first < d.first) {
      if (a.second < c.second && c.second < b.second) return true;
    }
    return false;
  };
  vector<vector<long long>> g(verts.size());
  for (int i = 0; i < verts.size(); i++) {
    for (int j = 0; j < hors.size(); j++) {
      if (inter(verts[i].first, verts[i].second, hors[j].first, hors[j].second))
        g[i].push_back(j);
    }
  }
  vector<long long> to(hors.size(), -1);
  vector<long long> used(verts.size(), 0);
  vector<long long> from(verts.size(), -1);
  function<bool(int)> dfs = [&](int v) {
    if (used[v]) return false;
    used[v] = 1;
    for (int u : g[v]) {
      if (to[u] == -1 || dfs(to[u])) {
        to[u] = v;
        from[v] = u;
        return true;
      }
    }
    return false;
  };
  for (int i = 0; i < verts.size(); i++) {
    used.assign(verts.size(), 0);
    dfs(i);
  }
  used.assign(verts.size(), 0);
  vector<long long> used1(hors.size(), 0);
  function<void(int)> dfs1 = [&](int v) {
    if (used[v]) return;
    used[v] = 1;
    for (int u : g[v]) {
      if (!used1[u]) {
        used1[u] = 1;
        dfs1(to[u]);
      }
    }
  };
  vector<long long> free(verts.size(), 1);
  for (int i : to)
    if (i != -1) free[i] = 0;
  for (int i = 0; i < verts.size(); i++)
    if (free[i]) dfs1(i);
  for (int i = 0; i < verts.size(); i++) {
    auto a = verts[i].first, b = verts[i].second;
    if (i == 0 || verts[i - 1].second != verts[i].first) {
      if (i > 0) v.push_back(verts[i - 1].second);
      v.push_back(a);
    }
    if (!used[i]) v.push_back(a), v.push_back(b);
  }
  if (!verts.empty()) v.push_back(verts.back().second);
  for (int i = 0; i < hors.size(); i++) {
    auto a = hors[i].first, b = hors[i].second;
    if (i == 0 || hors[i - 1].second != hors[i].first) {
      if (i > 0) h.push_back(hors[i - 1].second);
      h.push_back(a);
    }
    if (used1[i]) h.push_back(a), h.push_back(b);
  }
  if (!hors.empty()) h.push_back(hors.back().second);
  cout << h.size() / 2 << endl;
  for (int i = 0; i < h.size(); i++)
    cout << h[i].first << ' ' << h[i].second << ((i % 2) ? '\n' : ' ');
  cout << v.size() / 2 << endl;
  for (int i = 0; i < v.size(); i++)
    cout << v[i].first << ' ' << v[i].second << ((i % 2) ? '\n' : ' ');
  return 0;
}