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;
struct Point {
  int x;
  int y;
  Point() { x = y = 0; }
  Point(double _x, double _y) {
    x = _x;
    y = _y;
  }
  friend Point operator+(const Point &a, const Point &b) {
    return Point(b.x + a.x, b.y + a.y);
  }
  friend Point operator-(const Point &a, const Point &b) {
    return Point(a.x - b.x, a.y - b.y);
  }
  friend Point operator*(const Point &a, double p) {
    return Point(a.x * p, a.y * p);
  }
  friend Point operator/(const Point &a, double p) {
    return Point(a.x / p, a.y / p);
  }
  friend double operator*(const Point &p, const Point &a) {
    return (p.x * a.x + p.y * a.y);
  }
  friend double operator/(const Point &p, const Point &a) {
    return (p.x * a.y - p.y * a.x);
  }
  friend bool operator<(const Point &a, const Point &b) {
    if (a.x < b.x) return true;
    if (a.x > b.x) return false;
    if (a.y < b.y) return true;
    return false;
  }
  friend bool operator>(const Point &a, const Point &b) {
    if (a.x > b.x) return true;
    if (a.x < b.x) return false;
    if (a.y > b.y) return true;
    return false;
  }
  friend bool operator==(const Point &a, const Point &b) {
    return (a.x == b.x && a.y == b.y);
  }
  friend bool operator!=(const Point &a, const Point &b) {
    return (a.x != b.x || a.y != b.y);
  }
  double slope() { return y / x; }
  double measure() { return sqrt(x * x + y * y); }
  double angle() {
    double an = atan2(y, x);
    if (an < 0) an += 2 * 3.1415926535897932385;
    return an;
  }
  Point shrink() { return Point(1, y / x); }
};
struct Hashdata {
  Point p;
  int t;
  Hashdata() {
    p = Point();
    t = 0;
  }
  Hashdata(Point _p, int _t) {
    p = _p;
    t = _t;
  }
};
int n, m, hc, cc;
int leftone[100010], rightone[100010];
Point peter[200010], charles[4 * 200010], harry[200010];
int hull[200010], q[200010], nowtest;
Hashdata corner[3000007];
int point_hash(Point a) {
  int x = a.x, y = a.y;
  return (x * 10007 + y) % 3000007;
}
bool reader() {
  scanf("%d%d", &n, &m);
  if (n == 0) return false;
  for (int i = 1; i <= n; i++) leftone[i] = n, rightone[i] = 0;
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    peter[i] = Point(x, y);
    if (x < leftone[y]) leftone[y] = x;
    if (x > rightone[y]) rightone[y] = x;
  }
  return true;
}
void qsort(int l, int r) {
  int i = l, j = r;
  Point mid = charles[(l + r) / 2];
  do {
    while (charles[i] < mid) i++;
    while (charles[j] > mid) j--;
    if (i <= j) {
      Point t = charles[i];
      charles[i] = charles[j];
      charles[j] = t;
      i++;
      j--;
    }
  } while (i <= j);
  if (i < r) qsort(i, r);
  if (l < j) qsort(l, j);
}
void convex_hull(int vc) {
  int qh = 2;
  q[1] = vc;
  q[2] = vc - 1;
  for (int i = vc - 2; i >= 1; i--) {
    while ((qh >= 2) && ((charles[i] - charles[q[qh - 1]]) /
                             (charles[q[qh]] - charles[q[qh - 1]]) <=
                         0))
      qh--;
    qh++;
    q[qh] = i;
  }
  int qh1 = qh;
  for (int i = 1; i <= qh; i++) hull[i] = q[i];
  qh = 2;
  q[1] = 1;
  q[2] = 2;
  for (int i = 3; i <= vc; i++) {
    while ((qh >= 2) && ((charles[i] - charles[q[qh - 1]]) /
                             (charles[q[qh]] - charles[q[qh - 1]]) <=
                         0))
      qh--;
    qh++;
    q[qh] = i;
  }
  for (int i = 2; i < qh; i++) hull[qh1 + i - 1] = q[i];
  hc = qh1 + qh - 2;
  for (int i = 0; i < hc; i++) harry[i] = charles[hull[i + 1]];
}
bool in_hull(int x, int y) {
  if (x < leftone[y]) return false;
  if (x > rightone[y]) return false;
  return true;
}
bool check_zeroes(int x, int y) {
  if (!in_hull(x, y)) return false;
  if (!in_hull(x + 1, y)) return false;
  if (!in_hull(x, y + 1)) return false;
  if (!in_hull(x + 1, y + 1)) return false;
  return true;
}
void add_corner(Point a) {
  int h = point_hash(a);
  while (corner[h].t == nowtest) {
    if (corner[h].p == a) return;
    h = (h + 1) % 3000007;
  }
  corner[h] = Hashdata(a, nowtest);
  charles[++cc] = a;
}
void generate() {
  cc = 0;
  for (int i = 1; i <= m; i++) {
    int x = peter[i].x, y = peter[i].y;
    if (check_zeroes(x, y)) add_corner(Point(x, y));
    if (check_zeroes(x - 1, y)) add_corner(Point(x - 1, y));
    if (check_zeroes(x, y - 1)) add_corner(Point(x, y - 1));
    if (check_zeroes(x - 1, y - 1)) add_corner(Point(x - 1, y - 1));
  }
  qsort(1, cc);
}
void printer() {
  printf("%d\n", hc);
  Point starter = harry[0];
  int si = 0;
  for (int i = 1; i < hc; i++)
    if (harry[i] < starter) starter = harry[i], si = i;
  for (int i = si; i < hc; i++) {
    int x = harry[i].x, y = harry[i].y;
    printf("%d %d\n", x, y);
  }
  for (int i = 0; i < si; i++) {
    int x = harry[i].x, y = harry[i].y;
    printf("%d %d\n", x, y);
  }
}
int main() {
  nowtest = 1;
  while (reader()) {
    generate();
    convex_hull(cc);
    printer();
    nowtest += 2;
  }
}