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 double eps = 1e-8, pi = acos(-1);
bool lt(double a, double b) { return a + eps <= b; }
bool eq(double a, double b) { return a + eps > b && b + eps > a; }
int main() {
  int n, sum = 0, ok = 0, dx = 0, dy = 0;
  scanf("%d", &n);
  vector<int> u;
  vector<pair<int, int> > a, c;
  for (int r = 1; int(u.size()) != n + 1; r++) {
    int i, j;
    for (j = 0; j * j <= r; j++)
      ;
    for (i = 0; i * i <= r; i++) {
      while (i * i + j * j > r) j--;
      if (i * i + j * j == r) break;
    }
    if (i * i <= r) u.push_back(r);
  }
  sort(u.rbegin(), u.rend());
  for (int r : u) sum += r;
  for (int r : u)
    if ((sum - r) % 2 || ok++) {
      int i, j;
      for (j = 0; j * j <= r; j++)
        ;
      for (i = 0; i * i <= r; i++) {
        while (i * i + j * j > r) j--;
        if (i * i + j * j == r) c.push_back({i, j});
      }
      auto t =
          min_element(c.begin(), c.end(),
                      [&](const pair<int, int>& l, const pair<int, int>& r) {
                        int lx = (dx > 0 ? -1 : 1) * l.first + dx,
                            ly = (dy > 0 ? -1 : 1) * l.second + dy;
                        int rx = (dx > 0 ? -1 : 1) * r.first + dx,
                            ry = (dy > 0 ? -1 : 1) * r.second + dy;
                        return lx * lx + ly * ly < rx * rx + ry * ry;
                      });
      a.push_back(
          {(dx > 0 ? -1 : 1) * t->first, (dy > 0 ? -1 : 1) * t->second});
      dx += a.back().first;
      dy += a.back().second;
      c.clear();
    }
  sort(a.begin(), a.end(),
       [&](const pair<int, int>& l, const pair<int, int>& r) {
         double u = atan2(l.second, l.first);
         double v = atan2(r.second, r.first);
         if (eq(u, pi)) u = -pi;
         if (eq(v, pi)) v = -pi;
         return lt(u, v);
       });
  puts("YES");
  for (auto& r : a) printf("%d %d\n", dx += r.first, dy += r.second);
}