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;
struct pt {
  long long x, y;
  pt operator+(const pt& other) const { return {x + other.x, y + other.y}; }
  int halfplane() const {
    if (y > 0) {
      return 0;
    }
    if (y == 0 && x > 0) {
      return 0;
    }
    return 1;
  }
};
long long cross(const pt& p, const pt& q) { return p.x * q.y - p.y * q.x; }
bool operator<(const pt& p, const pt& q) {
  if (p.halfplane() != q.halfplane()) {
    return p.halfplane() < q.halfplane();
  }
  return cross(p, q) > 0;
}
struct datum {
  long long c;
  long long x, y;
  bool operator<(const datum& other) const { return c < other.c; }
  bool operator==(const datum& other) const { return c == other.c; }
};
long long len2(const pt& p) { return p.x * p.x + p.y * p.y; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<datum> vct;
  for (long long d = 1; (int)(vct).size() <= n + 30; ++d) {
    for (long long x = 0; x * x <= d; ++x) {
      long long y = sqrt(d - x * x);
      if (x * x + y * y == d) {
        vct.push_back({d, x, y});
        break;
      }
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    if (vct[i].c & 1) {
      ++cnt;
    }
  }
  if (cnt & 1) {
    vector<datum> res;
    vector<int> rem;
    if (vct[n].c & 1) {
      rem = {1, 0};
    } else {
      rem = {0, 1};
    }
    for (int r : rem) {
      for (int i = 0; i <= n; ++i) {
        if (vct[i].c % 2 == r && (int)(res).size() < n) {
          res.push_back(vct[i]);
        }
      }
    }
    vct.swap(res);
  } else {
    while ((int)(vct).size() > n) {
      vct.pop_back();
    }
  }
  sort((vct).begin(), (vct).end());
  assert((int)(vct).size() == n);
  cnt = 0;
  for (int i = 0; i < n; ++i) {
    if (vct[i].c & 1) {
      ++cnt;
    }
  }
  assert(cnt % 2 == 0);
  const long long inf = 1e9;
  pt curr = {0, 0};
  reverse((vct).begin(), (vct).end());
  vector<pt> dir;
  vector<bool> used(n, false);
  for (int i = 0; i < n; ++i) {
    pt opt = {inf, inf};
    {
      long long x = vct[i].x, y = vct[i].y;
      for (int sw = 0; sw < 2; ++sw) {
        for (int a = -1; a <= 1; a += 2) {
          for (int b = -1; b <= 1; b += 2) {
            pt p = {a * x, b * y};
            if (sw) {
              swap(p.x, p.y);
            }
            if (len2(curr + p) < len2(curr + opt)) {
              opt = p;
            }
          }
        }
      }
      dir.push_back(opt);
      curr = curr + opt;
    }
  }
  sort((dir).begin(), (dir).end());
  curr = {0, 0};
  cout << "YES\n";
  for (int i = 0; i < n; ++i) {
    cout << curr.x << " " << curr.y << "\n";
    curr = curr + dir[i];
  }
}