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;
const int di[] = {-1, +1, -1, +1};
const int dj[] = {-1, -1, +1, +1};
map<int, pair<int, int> > mm;
int n, s1, s2, best, bi, bj;
vector<pair<int, int> > vv, ans;
int aa(int x) { return x < 0 ? -x : x; }
bool diff(int a, int b) { return (a ^ b) & 1; }
void test(int ai, int aj) {
  int z = max(aa(s1 + ai), aa(s2 + aj));
  if (z < best) {
    best = z;
    bi = ai;
    bj = aj;
  }
}
bool cmp(pair<int, int> a, pair<int, int> b) {
  return atan2(1.0 * a.second, 1.0 * a.first) <
         atan2(1.0 * b.second, 1.0 * b.first) - 1e-6;
}
int main() {
  for (int x = 0; x < (int)(200); x++)
    if (x)
      for (int y = 0; y < (int)(x + 1); y++)
        if (mm.find(x * x + y * y) == mm.end())
          mm[x * x + y * y] = pair<int, int>(x, y);
  scanf("%d", &n);
  if (n == 3) {
    printf("YES\n0 0\n1 0\n0 2\n");
    return 0;
  }
  int cnt = 0;
  map<int, pair<int, int> >::iterator it;
  s1 = 0, s2 = 0;
  for (it = mm.begin(); it != mm.end() && cnt < n; it++, cnt++) {
    vv.push_back(it->second);
    s1 += it->second.first;
    s2 += it->second.second;
  }
  if (diff(s1, s2)) {
    if (diff(it->second.second, it->second.first)) {
      for (int q = (int)vv.size() - 1; q >= 0; q--)
        if (!diff(vv[q].second, vv[q].first)) {
          vv[q] = it->second;
          break;
        }
    } else {
      for (int q = (int)vv.size() - 1; q >= 0; q--)
        if (diff(vv[q].second, vv[q].first)) {
          vv[q] = it->second;
          break;
        }
    }
  }
  s1 = 0, s2 = 0;
  for (int i = (int)vv.size() - 1; i >= 0; i--) {
    best = (int)1e9;
    for (int q = 0; q < (int)(4); q++) {
      test(vv[i].first * di[q], vv[i].second * dj[q]);
      test(vv[i].second * di[q], vv[i].first * dj[q]);
    }
    s1 += bi;
    s2 += bj;
    ans.push_back(pair<int, int>(bi, bj));
  }
  fprintf(stderr, "s1 = %d, s2 = %d\n", s1, s2);
  sort(ans.begin(), ans.end(), cmp);
  int cx = 0, cy = 0;
  printf("YES\n");
  for (int q = 0; q < (int)(ans.size()); q++) {
    printf("%d %d\n", cx, cy);
    cx += ans[q].first, cy += ans[q].second;
  }
  return 0;
}