Problem: It happened at the times of the Great Berland Empire. Once the Emperor dreamt that the Messenger from the gods ordered to build a temple whose base would be a convex polygon with n angles. Next morning the Emperor gave the command to build a temple whose base was a regular polygon with n angles. The temple was built but soon the Empire was shaken with disasters and crop failures. After an earthquake destroyed the temple, the Emperor understood that he somehow caused the wrath of gods to fall on his people. He ordered to bring the wise man. When the wise man appeared, the Emperor retold the dream to him and asked "Oh the wisest among the wisest, tell me how could I have infuriated the Gods?". "My Lord," the wise man answered. "As far as I can judge, the gods are angry because you were too haste to fulfill their order and didn't listen to the end of the message".

Indeed, on the following night the Messenger appeared again. He reproached the Emperor for having chosen an imperfect shape for the temple. "But what shape can be more perfect than a regular polygon!?" cried the Emperor in his dream. To that the Messenger gave a complete and thorough reply. 

  * All the vertices of the polygon should be positioned in the lattice points. 
  * All the lengths of its sides should be different. 
  * From the possible range of such polygons a polygon which maximum side is minimal possible must be chosen. 



You are an obedient architect who is going to make the temple's plan. Note that the polygon should be simple (having a border without self-intersections and overlapping) and convex, however, it is acceptable for three consecutive vertices to lie on the same line.

Input

The first line contains the single number n (3 ≤ n ≤ 10000).

Output

Print "YES" (without quotes) in the first line if it is possible to build a polygon possessing the needed qualities. In the next n lines print integer coordinates of the polygon vertices in the order in which they would be passed counter clockwise. The absolute value of the coordinates shouldn't exceed 109. No two vertices can coincide. It is permitted to print any of the possible solutions. Print "NO" if to build the polygon is impossible.

Examples

Input

3


Output

YES
0 0
1 0
0 2


Input

3


Output

YES
0 1
-1 0
-1 -1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
int const M = 1010000;
int const N = 10100;
int n;
int len[N];
int x[N];
int y[N];
int sq[M];
int perm[N];
double angle[N];
int resx[N];
int resy[N];
void filllens() {
  std::fill(sq, sq + M, -1);
  for (int i = 0; i * i < M; ++i) {
    sq[i * i] = i;
  }
  int last = 0;
  int sum = 0;
  for (int i = n - 1; i >= 0; --i) {
    while (x[i] == 0 && y[i] == 0) {
      len[i] = ++last;
      x[i] = 0;
      y[i] = 0;
      for (int q = 0; q * q <= len[i]; ++q) {
        if (sq[len[i] - q * q] != -1) {
          x[i] = q;
          y[i] = sq[len[i] - q * q];
          break;
        }
      }
    }
    sum += len[i];
  }
  if (sum % 2 == 1) {
    int xx = 0;
    int yy = 0;
    while (xx == 0 && yy == 0) {
      ++last;
      for (int q = 0; q * q <= last; ++q) {
        if (sq[last - q * q] != -1) {
          xx = q;
          yy = sq[last - q * q];
          break;
        }
      }
    }
    int i = 0;
    while (len[i] % 2 == last % 2) ++i;
    len[i] = last;
    x[i] = xx;
    y[i] = yy;
    for (; i > 0; --i) {
      std::swap(len[i], len[i - 1]);
      std::swap(x[i], x[i - 1]);
      std::swap(y[i], y[i - 1]);
    }
  }
}
void solve() {
  filllens();
  int sumx = 0;
  int sumy = 0;
  std::function<int(int, int)> len2 = [](int x, int y) {
    return x * x + y * y;
  };
  for (int i = 0; i < n; ++i) {
    int ax = x[i];
    int ay = y[i];
    for (int it = 0; it < 2; ++it) {
      for (int px : {-1, 1}) {
        for (int py : {-1, 1}) {
          if (len2(sumx + ax, sumy + ay) >
              len2(sumx + px * x[i], sumy + py * y[i])) {
            ax = px * x[i];
            ay = py * y[i];
          }
        }
      }
      std::swap(x[i], y[i]);
    }
    x[i] = ax;
    y[i] = ay;
    sumx += ax;
    sumy += ay;
  }
  assert(sumx == 0 && sumy == 0);
  for (int i = 0; i < n; ++i) {
    perm[i] = i;
    angle[i] = atan2(x[i], y[i]);
  }
  std::sort(perm, perm + n, [](int i, int j) { return angle[i] > angle[j]; });
  sumx = 0;
  sumy = 0;
  for (int i = 0; i < n; ++i) {
    resx[i] = sumx;
    resy[i] = sumy;
    sumx += x[perm[i]];
    sumy += y[perm[i]];
  }
}
void out() {
  puts("YES");
  for (int i = 0; i < n; ++i) {
    printf("%d %d\n", resx[i], resy[i]);
  }
}
int main() {
  scanf("%d", &n);
  solve();
  out();
}