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>
#pragma comment(linker, "/STACK:100000000")
using namespace std;
vector<pair<int, pair<int, int> > > v;
bool take[1001000];
bool cmp(pair<int, int> a, pair<int, int> b) {
  double ang1 = atan2((double)a.first, (double)a.second);
  double ang2 = atan2((double)b.first, (double)b.second);
  if (fabs(ang1 - ang2) > 1e-9 && ang1 < ang2) return true;
  return false;
}
int sign[100100][2];
bool cmp2(pair<int, pair<int, int> > a, pair<int, pair<int, int> > b) {
  if (a.second.first > b.second.first) return true;
  return false;
}
bool cmp3(pair<int, pair<int, int> > a, pair<int, pair<int, int> > b) {
  if (a.second.second > b.second.second) return true;
  return false;
}
int main() {
  int n;
  scanf("%d", &n);
  if (n % 2 != 2) {
    int sum1 = 0;
    int sum2 = 0;
    for (int x = 0; x <= 200; x++) {
      for (int y = 0; y <= 200; y++) {
        if (x * x + y * y != 0 && !take[x * x + y * y])
          v.push_back(make_pair(x * x + y * y, make_pair(x, y))),
              take[x * x + y * y] = true;
      }
    }
    sort(v.begin(), v.end());
    for (int i = 0; i < n; i++) {
      sum1 += v[i].second.first;
      sum2 += v[i].second.second;
    }
    int p = 0;
    if (sum1 % 2 == 1 || sum2 % 2 == 1) {
      for (int i = 0; i < n; i++) {
        sum1 -= v[i].second.first;
        sum2 -= v[i].second.second;
        bool br = false;
        for (int x = 0; x <= 200; x++) {
          for (int y = 0; y <= 200; y++) {
            if (x * x + y * y == v[i].first && (sum1 + x) % 2 == 0 &&
                (sum2 + y) % 2 == 0) {
              v[i].second.first = x;
              v[i].second.second = y;
              x = 101;
              y = 101;
              br = true;
            }
          }
        }
        sum1 += v[i].second.first;
        sum2 += v[i].second.second;
        if (br) break;
      }
    }
    if (sum1 % 2 == 1 || sum2 % 2 == 1) {
      sum1 += v[n].second.first;
      sum2 += v[n].second.second;
      vector<pair<int, pair<int, int> > > newv;
      for (int i = n; i >= 0; i--) {
        if ((sum1 - v[i].second.first) % 2 == 0 &&
            (sum2 - v[i].second.second) % 2 == 0) {
          p = i;
          break;
        }
      }
      for (int i = 0; i <= n; i++) {
        if (i != p) {
          newv.push_back(v[i]);
        }
      }
      swap(newv, v);
    }
    for (int i = 0; i < n; i++) {
      v[i].first = i;
    }
    while ((int)(v).size() > n) v.pop_back();
    sort(v.begin(), v.end(), cmp2);
    int curx = v[0].second.first;
    sign[v[0].first][0] = 1;
    for (int i = 1; i < n; i++) {
      if (curx > 0) {
        curx -= v[i].second.first;
        sign[v[i].first][0] = -1;
      } else {
        curx += v[i].second.first;
        sign[v[i].first][0] = 1;
      }
    }
    sort(v.begin(), v.end(), cmp3);
    int cury = v[0].second.second;
    sign[v[0].first][1] = 1;
    for (int i = 1; i < n; i++) {
      if (cury > 0) {
        cury -= v[i].second.second;
        sign[v[i].first][1] = -1;
      } else {
        cury += v[i].second.second;
        sign[v[i].first][1] = 1;
      }
    }
    sort(v.begin(), v.end());
    vector<pair<int, int> > path;
    for (int i = 0; i < n; i++) {
      path.push_back(make_pair(v[i].second.first * sign[i][0],
                               v[i].second.second * sign[i][1]));
    }
    printf("YES\n");
    sort(path.rbegin(), path.rend(), cmp);
    curx = 0;
    cury = 0;
    for (int i = 0; i < n; i++) {
      curx += path[i].first;
      cury += path[i].second;
      printf("%d %d\n", curx, cury);
    }
  }
  return 0;
}