Problem: Zombies have found out about the Zombie Contamination level checker and managed to damage it! Now detecting the shape of their main compound will be a real challenge for Heidi. As before, a lair can be represented as a strictly convex polygon on a lattice. Each vertex of the polygon occupies a point on the lattice. However, the damaged Zombie Contamination level checker can only tell, for each cell, whether the level of Zombie Contamination for that cell is in the set {1, 2, 3}. In other words, Heidi knows all the cells of the lattice for which the Contamination level is not 0 and not 4.

Given this information, Heidi still wants to know the exact shape of the lair to rain destruction on the zombies. Help her!

Input

The input contains multiple test cases.

The first line of each test case contains two space-separated integers N and M, where N is the size of the lattice grid (5 ≤ N ≤ 100000) and M is the number of lattice points for which the Zombie Contamination level is 1, 2, or 3 (8 ≤ M ≤ 200000).

The second line of each test case contains M pairs of integers x1, y1, ..., xM, yM – coordinates of the cells with Zombie Contamination level not equal to 0 nor 4. It is guaranteed that 1 ≤ xi, yi ≤ N. All pairs xi, yi are different.

Cells are enumerated based on the coordinates of their upper right corner. This means that the bottommost leftmost cell that touches the origin has coordinates (1, 1), and the uppermost leftmost cell is identified as (1, N).

The last line of the file contains two zeroes. This line should not be treated as a test case. The sum of the M values for all tests in one file will not exceed 200000.

Output

For each test case, the following output is expected:

The first line of the output should contain one integer V, the number of vertices of the polygon that is the secret lair. The next V lines each should contain two integers, denoting the vertices of the polygon in the clockwise order, starting from the lexicographically smallest vertex.

Example

Input

8 19
2 3 2 4 2 5 3 3 3 5 4 3 4 5 4 6 5 2 5 3 5 6 6 2 6 3 6 4 6 5 6 6 6 7 7 6 7 7
5 8
2 2 2 3 2 4 3 2 3 4 4 2 4 3 4 4
0 0


Output

4
2 3
2 4
6 6
5 2
4
2 2
2 3
3 3
3 2

Note

It is guaranteed that the solution always exists and is unique. It is guaranteed that in the correct solution the coordinates of the polygon vertices are between 1 and N - 1. A vertex (x1, y1) is lexicographically smaller than vertex (x2, y2) if x1 < x2 or <image>.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100000;
const int MAX_M = 200000;
const int INF = 1 << 30;
const int dxs[] = {1, 0, -1, 0}, dys[] = {0, 1, 0, -1};
template <typename T>
struct Pt {
  T x, y;
  Pt() {}
  Pt(T _x, T _y) : x(_x), y(_y) {}
  Pt(const Pt<T> &p) : x(p.x), y(p.y) {}
  Pt<T> operator+(const Pt<T> p) const { return Pt<T>(x + p.x, y + p.y); }
  Pt<T> operator-() const { return Pt<T>(-x, -y); }
  Pt<T> operator-(const Pt<T> p) const { return Pt<T>(x - p.x, y - p.y); }
  Pt<T> operator*(T t) const { return Pt<T>(x * t, y * t); }
  Pt<T> operator/(T t) const { return Pt<T>(x / t, y / t); }
  T dot(Pt<T> v) const { return x * v.x + y * v.y; }
  T cross(Pt<T> v) const { return x * v.y - y * v.x; }
  Pt<T> mid(const Pt<T> p) { return Pt<T>((x + p.x) / 2, (y + p.y) / 2); }
  T d2() { return x * x + y * y; }
  double d() { return sqrt(d2()); }
  Pt<T> rot(double th) {
    double c = cos(th), s = sin(th);
    return Pt<T>(c * x - s * y, s * x + c * y);
  }
  bool operator==(const Pt<T> pt) const { return x == pt.x && y == pt.y; }
  bool operator<(const Pt<T> &pt) const {
    return x < pt.x || (x == pt.x && y < pt.y);
  }
  void print() { printf("(%d,%d)", x, y); }
};
int lxs[MAX_N], rxs[MAX_N];
Pt<int> sps[MAX_M], ps[MAX_M];
void convex_hull(int n, Pt<int> ps[], vector<Pt<int> > &chs) {
  vector<Pt<int> > lhs, uhs;
  lhs.push_back(ps[0]);
  lhs.push_back(ps[1]);
  for (int i = 2; i < n; i++) {
    while (lhs.size() >= 2) {
      int ln = lhs.size();
      Pt<int> &lh0 = lhs[ln - 2], &lh1 = lhs[ln - 1];
      if ((lh1 - lh0).cross(ps[i] - lh1) > 0) break;
      lhs.pop_back();
    }
    lhs.push_back(ps[i]);
  }
  uhs.push_back(ps[n - 1]);
  uhs.push_back(ps[n - 2]);
  for (int i = n - 3; i >= 0; i--) {
    while (uhs.size() >= 2) {
      int un = uhs.size();
      Pt<int> &uh0 = uhs[un - 2], &uh1 = uhs[un - 1];
      if ((uh1 - uh0).cross(ps[i] - uh1) > 0) break;
      uhs.pop_back();
    }
    uhs.push_back(ps[i]);
  }
  lhs.pop_back();
  uhs.pop_back();
  chs.clear();
  chs.reserve(lhs.size() + uhs.size());
  chs.assign(lhs.begin(), lhs.end());
  chs.insert(chs.end(), uhs.begin(), uhs.end());
}
inline void setmin(int &a, int b) {
  if (a > b) a = b;
}
inline void setmax(int &a, int b) {
  if (a < b) a = b;
}
inline bool iszero(int n, int x, int y) {
  return (x < 0 || x >= n || y < 0 || y >= n || x < lxs[y] || x > rxs[y]);
}
int main() {
  for (int n, m; scanf("%d%d", &n, &m) == 2 && n > 0;) {
    fill(lxs, lxs + n, INF);
    fill(rxs, rxs + n, -1);
    for (int i = 0; i < m; i++) {
      scanf("%d%d", &sps[i].x, &sps[i].y);
      sps[i].x--, sps[i].y--;
      setmin(lxs[sps[i].y], sps[i].x);
      setmax(rxs[sps[i].y], sps[i].x);
    }
    sort(sps, sps + m);
    int l = 0;
    for (int i = 0; i < m; i++) {
      int x = sps[i].x, y = sps[i].y;
      int c = 0, b = 0;
      for (int di = 0; di < 4; di++) {
        int vx = x + dxs[di], vy = y + dys[di];
        if (!iszero(n, vx, vy)) c++, b |= (1 << di);
      }
      if (c == 2) {
        switch (b) {
          case 3:
            ps[l] = Pt<int>(x + 1, y + 1);
            break;
          case 6:
            ps[l] = Pt<int>(x, y + 1);
            break;
          case 12:
            ps[l] = Pt<int>(x, y);
            break;
          case 9:
            ps[l] = Pt<int>(x + 1, y);
            break;
        }
        l++;
      }
    }
    sort(ps, ps + l);
    l = unique(ps, ps + l) - ps;
    vector<Pt<int> > cps;
    convex_hull(l, ps, cps);
    int k = cps.size();
    printf("%d\n", k);
    for (int i = 0, j = 0; i < k; i++, j = (j + k - 1) % k)
      printf("%d %d\n", cps[j].x, cps[j].y);
  }
  return 0;
}