#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int inf_ = 0x7fffffff;
const long long inff = 4557430888798830399ll;
const double pi = acos(-1.0);
long long mod = 1e9 + 7;
struct HUNGARY {
  HUNGARY() { init(0, 0); };
  int n, m, to[10004], vt[10004];
  bool vis[10004];
  vector<int> N[10004];
  void init(int _n, int _m) {
    n = _n;
    m = _m;
    for (int i = (1); i <= (n); ++i) N[i].clear();
    memset(to, 0, sizeof(to));
    memset(vt, 0, sizeof(vt));
  }
  void link(int u, int v) { N[u].push_back(v); }
  bool dfs(int u) {
    for (auto v : N[u])
      if (!vis[v]) {
        vis[v] = 1;
        if (!to[v] || dfs(to[v])) {
          to[v] = u, vt[u] = v;
          return 1;
        }
      }
    return 0;
  }
  void run() {
    for (int i = (1); i <= (n); ++i)
      if (!vt[i]) {
        memset(vis, 0, sizeof(vis));
        dfs(i);
      }
  }
  set<int> A, B;
  void dfsc(int u) {
    A.erase(u);
    for (auto v : N[u])
      if (!vis[v]) {
        vis[v] = 1;
        B.insert(v);
        if (to[v] && A.count(to[v])) dfsc(to[v]);
      }
  }
  void cover() {
    memset(vis, 0, sizeof(vis));
    A.clear();
    B.clear();
    for (int i = (1); i <= (n); ++i) A.insert(i);
    for (int i = (1); i <= (n); ++i)
      if (!vt[i]) dfsc(i);
  }
} h;
map<int, vector<int> > X, Y;
vector<pair<pair<int, int>, pair<int, int> > > V, H, A, B;
void pt(pair<int, int> p) { cout << "(" << p.first << "," << p.second << ")"; }
bool cross(pair<pair<int, int>, pair<int, int> > p,
           pair<pair<int, int>, pair<int, int> > q) {
  return q.first.first < p.first.first && p.first.first < q.second.first &&
         p.first.second < q.second.second && q.second.second < p.second.second;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, x, y;
  vector<pair<int, int> > z;
  int o[10004];
  cin >> n;
  for (int i = (0); i < (n); ++i) {
    cin >> x >> y;
    X[x].push_back(y);
    Y[y].push_back(x);
    z.push_back(make_pair(x, y));
  }
  for (auto z : X) {
    sort((z.second).begin(), (z.second).end());
    for (int i = (0); i < (((int)z.second.size()) - 1); ++i)
      V.push_back(make_pair(make_pair(z.first, z.second[i]),
                            make_pair(z.first, z.second[i + 1])));
  }
  for (auto z : Y) {
    sort((z.second).begin(), (z.second).end());
    for (int i = (0); i < (((int)z.second.size()) - 1); ++i)
      H.push_back(make_pair(make_pair(z.second[i], z.first),
                            make_pair(z.second[i + 1], z.first)));
  }
  h.init(((int)V.size()), ((int)H.size()));
  for (int i = (0); i < (((int)V.size())); ++i)
    for (int j = (0); j < (((int)H.size())); ++j)
      if (cross(V[i], H[j])) h.link(i + 1, j + 1);
  h.run();
  h.cover();
  for (int i = (0); i < (((int)V.size())); ++i)
    if (!h.A.count(i + 1)) {
      if (!((int)A.size()) || A.back().second != V[i].first)
        A.push_back(V[i]);
      else
        A[((int)A.size()) - 1].second = V[i].second;
    }
  for (int i = (0); i < (((int)H.size())); ++i)
    if (!h.B.count(i + 1)) {
      if (!((int)B.size()) || B.back().second != H[i].first)
        B.push_back(H[i]);
      else
        B[((int)B.size()) - 1].second = H[i].second;
    }
  memset(o, 0, sizeof(o));
  for (int i = (0); i < (((int)z.size())); ++i) {
    for (int j = (0); j < (((int)A.size())); ++j)
      if (A[j].first.first == z[i].first && A[j].first.second <= z[i].second &&
          z[i].second <= A[j].second.second)
        o[i] |= 1;
    for (int j = (0); j < (((int)B.size())); ++j)
      if (B[j].second.second == z[i].second && B[j].first.first <= z[i].first &&
          z[i].first <= B[j].second.first)
        o[i] |= 2;
  }
  for (int i = (0); i < (((int)z.size())); ++i) {
    if ((o[i] & 1) == 0) A.push_back(make_pair(z[i], z[i]));
    if ((o[i] & 2) == 0) B.push_back(make_pair(z[i], z[i]));
  }
  swap(A, B);
  cout << ((int)A.size()) << endl;
  for (auto z : A)
    cout << z.first.first << " " << z.first.second << " " << z.second.first
         << " " << z.second.second << endl;
  cout << ((int)B.size()) << endl;
  for (auto z : B)
    cout << z.first.first << " " << z.first.second << " " << z.second.first
         << " " << z.second.second << endl;
}
