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 {
  long long x, y;
  int id;
  point(){};
  point(long long _x, long long _y, int _id) : x(_x), y(_y), id(_id){};
};
struct vect {
  long long x, y;
  vect(){};
  vect(long long _x, long long _y) : x(_x), y(_y){};
  vect(point a, point b) : x(b.x - a.x), y(b.y - a.y){};
};
long long crossProductNorm(vect a, vect b) { return a.x * b.y - b.x * a.y; }
bool isCCW(vect a, vect b) { return crossProductNorm(a, b) < 0; }
long long dst(point a, point b) {
  return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
}
point refPoint;
bool compCW(point a, point b) {
  vect aVect(refPoint, a);
  vect bVect(refPoint, b);
  return isCCW(aVect, bVect) || (crossProductNorm(aVect, bVect) == 0 &&
                                 dst(refPoint, a) < dst(refPoint, b));
}
vector<point> constructConvexHull(vector<point> &pts) {
  if (pts.empty()) {
    vector<point> v;
    return v;
  }
  int minY = pts[0].y, minX = pts[0].x;
  int minYP = 0;
  for (int i = (1); i < (pts.size()); i++)
    if (pts[i].y < minY || (pts[i].y == minY && pts[i].x < minX))
      minY = pts[i].y, minX = pts[i].x, minYP = i;
  refPoint = pts[minYP];
  pts.erase(pts.begin() + minYP);
  sort(pts.begin(), pts.end(), compCW);
  pts.insert(pts.begin(), refPoint);
  vector<point> myCH;
  myCH.push_back(pts[0]);
  for (int i = (1); i < (pts.size()); i++) {
    while (myCH.size() >= 2) {
      vect v1(myCH[myCH.size() - 1], pts[i]);
      vect v2(myCH[myCH.size() - 2], myCH[myCH.size() - 1]);
      if (!isCCW(v2, v1))
        myCH.pop_back();
      else
        break;
    }
    myCH.push_back(pts[i]);
  }
  while (myCH.size() > 2) {
    vect v1(myCH[myCH.size() - 1], pts[0]);
    vect v2(myCH[myCH.size() - 2], myCH[myCH.size() - 1]);
    if (!isCCW(v2, v1))
      myCH.pop_back();
    else
      break;
  }
  return myCH;
}
pair<int, int> mny[100005], mnx[100005], mxy[100005], mxx[100005];
int T;
int main() {
  while (1) {
    int n, M;
    scanf("%d %d", &n, &M);
    if (n == 0) return 0;
    set<pair<int, int> > tp;
    set<pair<int, int> > cnd;
    T++;
    for (int t = (0); t < (M); t++) {
      int x, y;
      scanf("%d %d", &x, &y);
      x--;
      y--;
      tp.emplace(x, y);
      if (mny[x].second != T) mny[x] = make_pair(y, T);
      if (mxy[x].second != T) mxy[x] = make_pair(y, T);
      if (mnx[y].second != T) mnx[y] = make_pair(x, T);
      if (mxx[y].second != T) mxx[y] = make_pair(x, T);
      mny[x].first = min(mny[x].first, y);
      mxy[x].first = max(mxy[x].first, y);
      mnx[y].first = min(mnx[y].first, x);
      mxx[y].first = max(mxx[y].first, x);
      for (int dy = (-1); dy < (2); dy++)
        for (int dx = (-1); dx < (2); dx++) {
          cnd.emplace(x + dx, y + dy);
        }
    }
    vector<point> vp;
    for (auto p : cnd) {
      int x = p.first, y = p.second;
      int cnt = 0;
      for (int dy = (-1); dy < (1); dy++)
        for (int dx = (-1); dx < (1); dx++) {
          cnt += tp.count(make_pair(x + dx, y + dy));
        }
      if (cnt == 4) {
        vp.emplace_back(x, y, 0);
      } else if (cnt == 3) {
        for (int dy = (-1); dy < (1); dy++)
          for (int dx = (-1); dx < (1); dx++) {
            if (!tp.count(make_pair(x + dx, y + dy))) {
              int nx = x + dx, ny = y + dy;
              if (mny[nx].first > ny || mxy[nx].first < ny ||
                  mnx[ny].first > nx || mxx[ny].first < nx) {
              } else {
                vp.emplace_back(x, y, 0);
              }
            }
          }
      }
    }
    vector<point> ch = constructConvexHull(vp);
    int m = int(ch.size());
    int make_pair = 0;
    for (int i = (1); i < (m); i++)
      if (ch[i].x < ch[make_pair].x ||
          (ch[i].x == ch[make_pair].x && ch[i].y < ch[make_pair].y))
        make_pair = i;
    printf("%d\n", m);
    for (int i = (0); i < (m); i++)
      printf("%lld %lld\n", ch[(make_pair + i) % m].x,
             ch[(make_pair + i) % m].y);
  }
}