#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 9;
const long long int MOD = 1e9 + 696969;
const long long INF = 1e18 + 3;
const int maxn = 2010;
int n, m;
const int W = 2010;
pair<int, int> pox[maxn], poy[maxn];
int skoj[W];
vector<int> v[W];
bool odw[W], chosen[W];
bool dfs(int x) {
  if (odw[x]) return false;
  odw[x] = 1;
  for (auto u : v[x])
    if (skoj[u] == -1 || dfs(skoj[u])) {
      skoj[u] = x;
      skoj[x] = u;
      return true;
    }
  return false;
}
queue<int> q;
void bfs() {
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (auto u : v[x]) {
      assert(skoj[u] != -1);
      if (!chosen[skoj[u]]) {
        chosen[skoj[u]] = 1;
        q.push(skoj[u]);
      }
    }
  }
}
int DL = 0;
int INVERT[2010], KT[2010];
inline long long int det(pair<long long int, long long int> a,
                         pair<long long int, long long int> b) {
  return a.first * b.second - a.second * b.first;
}
inline long long int area(pair<long long int, long long int> a,
                          pair<long long int, long long int> b,
                          pair<long long int, long long int> c) {
  return det(a, b) + det(b, c) + det(c, a);
}
inline bool isLeft(pair<long long int, long long int> a,
                   pair<long long int, long long int> b,
                   pair<long long int, long long int> c) {
  return (area(a, b, c) > 0);
}
inline long long int sqr(long long int x) { return x * x; }
inline long long int dist(pair<long long int, long long int> a,
                          pair<long long int, long long int> b) {
  return sqr(a.first - b.first) + sqr(a.second - b.second);
}
inline bool Inside(pair<long long int, long long int> a,
                   pair<long long int, long long int> b,
                   pair<long long int, long long int> c) {
  if (area(a, b, c) != 0) return 0;
  long long int dbc = dist(b, c), dac = dist(a, c), dab = dist(a, b);
  if (dbc <= dab && dac <= dab) return 1;
  return 0;
}
inline bool Intersect(pair<long long int, long long int> a,
                      pair<long long int, long long int> b,
                      pair<long long int, long long int> c,
                      pair<long long int, long long int> d) {
  if (Inside(a, b, c)) return 0;
  if (Inside(a, b, d)) return 0;
  if (Inside(c, d, a)) return 0;
  if (Inside(c, d, b)) return 0;
  long long int A1 = area(a, b, c), A2 = area(a, b, d);
  long long int B1 = area(c, d, a), B2 = area(c, d, b);
  if (A1 > 0 && A2 > 0) return 0;
  if (A1 < 0 && A2 < 0) return 0;
  if (B1 > 0 && B2 > 0) return 0;
  if (B1 < 0 && B2 < 0) return 0;
  if (A1 == 0 || A2 == 0 || B1 == 0 || B2 == 0) return 0;
  return 1;
}
vector<pair<pair<long long int, long long int>, pair<int, long long int> > >
    odc1, odc2;
bool gold[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  int t = 1;
  while (t--) {
    cin >> n;
    for (int i = (1); i <= (n); ++i) cin >> pox[i].first >> pox[i].second;
    sort(pox + 1, pox + n + 1);
    for (int i = (1); i <= (n); ++i) {
      poy[i] = pox[i];
      swap(poy[i].first, poy[i].second);
    }
    sort(poy + 1, poy + n + 1);
    for (int i = (1); i <= (n); ++i) swap(poy[i].first, poy[i].second);
    for (int i = (2); i <= (n); ++i)
      if (pox[i].first == pox[i - 1].first) {
        KT[i] = ++DL;
        INVERT[DL] = i;
      }
    for (int i = (2); i <= (n); ++i)
      if (poy[i].second == poy[i - 1].second) {
        KT[i + n] = ++DL;
        INVERT[DL] = i + n;
      }
    for (int i = (2); i <= (n); ++i)
      for (int j = (2); j <= (n); ++j)
        if (pox[i].first == pox[i - 1].first &&
            poy[j].second == poy[j - 1].second) {
          pair<pair<long long int, long long int>, pair<int, long long int> >
              jed = make_pair(make_pair(pox[i - 1].first, pox[i - 1].second),
                              make_pair(pox[i].first, pox[i].second));
          pair<pair<long long int, long long int>, pair<int, long long int> >
              dwa = make_pair(make_pair(poy[j - 1].first, poy[j - 1].second),
                              make_pair(poy[j].first, poy[j].second));
          if (Intersect(jed.first, jed.second, dwa.first, dwa.second)) {
            v[KT[i]].push_back(KT[j + n]);
            v[KT[j + n]].push_back(KT[i]);
          }
        }
    for (int i = (1); i <= (DL); ++i) skoj[i] = -1;
    int ult_result = 2 * n;
    bool ist = 1;
    int sz = 0;
    while (ist) {
      ist = false;
      for (int i = (1); i <= (DL); ++i) odw[i] = false;
      for (int i = (1); i <= (DL); ++i)
        if (!odw[i] && skoj[i] == -1 && dfs(i)) ist = true, ++sz;
    }
    while (!q.empty()) q.pop();
    int cnt = 0;
    for (int i = (1); i <= (DL); ++i)
      if (skoj[i] == -1) ++cnt, q.push(i), chosen[i] = 1;
    bfs();
    for (int i = (1); i <= (DL); ++i)
      if (!chosen[i] && !chosen[skoj[i]]) chosen[i] = 1;
    for (int i = (1); i <= (DL); ++i) gold[INVERT[i]] = chosen[i];
    for (int i = (1); i <= (n); ++i)
      if (!gold[i])
        odc1.push_back(make_pair(pox[i], pox[i]));
      else {
        int sajs = (int)odc1.size() - 1;
        odc1[sajs].second = pox[i];
      }
    for (int i = (1); i <= (n); ++i)
      if (!gold[i + n])
        odc2.push_back(make_pair(poy[i], poy[i]));
      else {
        int sajs = (int)odc2.size() - 1;
        odc2[sajs].second = poy[i];
      }
    swap(odc1, odc2);
    cout << (int)odc1.size() << "\n";
    for (auto u : odc1)
      cout << u.first.first << ' ' << u.first.second << ' ' << u.second.first
           << ' ' << u.second.second << "\n";
    cout << (int)odc2.size() << "\n";
    for (auto u : odc2)
      cout << u.first.first << ' ' << u.first.second << ' ' << u.second.first
           << ' ' << u.second.second << "\n";
  }
}
