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>
using namespace std;
double fRand(double fMin, double fMax) {
  double f = (double)rand() / RAND_MAX;
  return fMin + f * (fMax - fMin);
}
template <class T>
T min(T a, T b, T c) {
  return min(a, min(b, c));
}
template <class T>
T max(T a, T b, T c) {
  return max(a, max(b, c));
}
const double PI = acos(-1.0);
struct pt {
  int x, y;
  pt operator+(pt p) { return {x + p.x, y + p.y}; }
  pt operator-(pt p) { return {x - p.x, y - p.y}; }
  int operator*(pt p) { return x * p.y - y * p.x; }
  int operator%(pt p) { return x * p.x + y * p.y; }
};
bool half(pt p) { return (p.y > 0 || (p.y == 0 && p.x < 0)); }
bool cmpPolar(pt &v, pt &w) {
  return make_tuple(half(v), 0) < make_tuple(half(w), v * w);
}
const int MAXN = 1e4 + 5;
const int MAXK = 105;
const int oo = 1e9 + 7;
int n, trace[MAXN + MAXK][MAXK][2][2], px[MAXN], py[MAXN], signX[MAXN],
    signY[MAXN];
vector<int> candR;
pt e[MAXN];
void knapsack(int a[], int sign[]) {
  int maxA = *max_element(a, a + n);
  vector<vector<int> > trace(n + 1, vector<int>(2 * maxA + 1, 0));
  trace[0][maxA] = -1;
  for (int i = (0); i <= (n - 1); ++i) {
    for (int j = (0); j <= (2 * maxA); ++j) {
      if (!trace[i][j]) continue;
      if (j >= a[i]) trace[i + 1][j - a[i]] = -1;
      if (j + a[i] <= 2 * maxA) trace[i + 1][j + a[i]] = 1;
    }
  }
  int i = n, j = maxA;
  assert(trace[i][j] != 0);
  while (i > 0) {
    sign[i - 1] = trace[i][j];
    j -= a[i - 1] * sign[i - 1];
    --i;
  }
}
int main() {
  scanf("%d", &n);
  if (n == 3) {
    puts("YES");
    puts("0 0");
    puts("1 0");
    puts("0 2");
    return 0;
  }
  for (int i = (0); i <= (MAXN + MAXK - 1); ++i)
    for (int k = (0); k <= (MAXK - 1); ++k)
      for (int rx = (0); rx <= (1); ++rx)
        for (int ry = (0); ry <= (1); ++ry) trace[i][k][rx][ry] = -1;
  trace[0][0][0][0] = 0;
  int i = 0, k = -1;
  for (int r = 1;; ++r) {
    vector<int> p;
    for (int x = (0); x <= (sqrt(r)); ++x) {
      int y2 = r - x * x, y = sqrt(y2);
      if (y * y == y2) p.push_back(x);
    }
    if ((int)p.size() == 0) continue;
    candR.push_back(r);
    for (int k = (0); k <= (MAXK - 1); ++k) {
      for (int rx = (0); rx <= (1); ++rx) {
        for (int ry = (0); ry <= (1); ++ry) {
          if (trace[i][k][rx][ry] == -1) continue;
          if (k < MAXK - 1) trace[i + 1][k + 1][rx][ry] = oo;
          for (int x : p) {
            int y = sqrt(r - x * x);
            trace[i + 1][k][(rx + x) & 1][(ry + y) & 1] = x;
          }
        }
      }
    }
    ++i;
    if (i >= n && trace[i][i - n][0][0] != -1) {
      k = i - n;
      break;
    }
  }
  int rx = 0, ry = 0;
  while (i > 0) {
    if (trace[i][k][rx][ry] == oo)
      --k;
    else {
      int x = trace[i][k][rx][ry];
      int y = sqrt(candR[i - 1] - x * x);
      px[i - k - 1] = x;
      py[i - k - 1] = y;
      rx = ((rx - x) % 2 + 2) % 2;
      ry = ((ry - y) % 2 + 2) % 2;
    }
    --i;
  }
  knapsack(px, signX);
  knapsack(py, signY);
  for (int i = (0); i <= (n - 1); ++i)
    e[i] = {px[i] * signX[i], py[i] * signY[i]};
  sort(e, e + n, cmpPolar);
  pt p = {0, 0};
  puts("YES");
  for (int i = (0); i <= (n - 1); ++i) {
    printf("%d %d\n", p.x, p.y);
    p = p + e[i];
  }
  return 0;
}