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;
int n;
vector<pair<int, int> > v;
int y = 0, x = 0;
const double PI = atan2(0, -1);
inline int len2(const pair<int, int> &x) {
  return x.first * x.first + x.second * x.second;
}
inline bool cmp(const pair<int, int> &lhs, const pair<int, int> &rhs) {
  return len2(lhs) < len2(rhs);
}
inline bool eq(const pair<int, int> &lhs, const pair<int, int> &rhs) {
  return len2(lhs) == len2(rhs);
}
inline bool cmp2(const pair<int, int> &lhs, const pair<int, int> &rhs) {
  double l = atan2(lhs.first, lhs.second);
  double r = atan2(rhs.first, rhs.second);
  if (l < 0) l += 2 * PI;
  if (r < 0) r += 2 * PI;
  return l < r;
}
int main() {
  for (int i = 0; i < (int)(300); ++i)
    for (int j = i; j < 300; ++j)
      if (i || j) v.push_back(make_pair(i, j));
  sort(v.begin(), v.end(), cmp);
  v.erase(unique(v.begin(), v.end(), eq), v.end());
  scanf("%d", &n);
  printf("YES\n");
  if (n == 3) {
    printf("0 0\n1 0\n0 2\n");
    return 0;
  }
  for (int i = 0; i < (int)(n); ++i) y += v[i].first, x += v[i].second;
  if ((y + x) % 2 == 1) {
    for (int j = 0; j < (int)(n); ++j)
      if (((v[j].first + v[j].second) ^ (v[n].first + v[n].second)) & 1) {
        y += v[n].first - v[j].first;
        x += v[n].second - v[j].second;
        v[j] = v[n];
        break;
      }
  }
  assert((x + y) % 2 == 0);
  int tt = 300;
  while (y + x != 0) {
    int bestx = 0, besty = 0;
    for (int i = 1; i < n; ++i)
      if (abs(y + x - 2 * v[i].first) < abs(y + x - 2 * v[besty].first)) {
        besty = i;
      }
    for (int i = 1; i < n; ++i)
      if (abs(y + x - 2 * v[i].second) < abs(y + x - 2 * v[bestx].second)) {
        bestx = i;
      }
    if (++tt % 10 == 9) {
      bestx = (tt / 10 * 1007 + 123) % n;
      besty = (tt / 10 * 1009 + 321) % n;
    }
    if (abs(y + x - 2 * v[besty].first) < abs(y + x - 2 * v[bestx].second)) {
      y -= 2 * v[besty].first;
      v[besty].first *= -1;
    } else {
      x -= 2 * v[bestx].second;
      v[bestx].second *= -1;
    }
  }
  tt = 300;
  while (y != 0) {
    int best = 0;
    for (int i = 1; i < n; ++i)
      if (abs(y - v[i].first + v[i].second) <
          abs(y - v[best].first + v[best].second)) {
        best = i;
      }
    if (++tt % 10 == 9) {
      best = (tt / 10 * 1007 + 123) % n;
    }
    y -= v[best].first - v[best].second;
    swap(v[best].first, v[best].second);
  }
  v.resize(n);
  sort(v.begin(), v.end(), cmp2);
  for (int i = 1; i < n; ++i) {
    v[i].first += v[i - 1].first;
    v[i].second += v[i - 1].second;
  }
  printf("0 0\n");
  for (int i = 0; i < (int)(n - 1); ++i)
    printf("%d %d\n", v[i].second, v[i].first);
  return 0;
}