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 vis[200010];
int x[200010], y[200010], id[200010], n, cnt;
pair<int, int> p[200010];
void init() {
  for (int i = 0; i < 310; i++)
    for (int j = 0; j < 310; j++) {
      vis[i * i + j * j] = 1;
      p[i * i + j * j] = pair<int, int>(i, j);
    }
}
void get_sign(int *x) {
  for (int i = 1; i <= n; i++) p[i] = pair<int, int>(x[i], i);
  sort(p + 1, p + n + 1);
  reverse(p + 1, p + n + 1);
  int d = 0;
  for (int i = 1; i < n; i += 2) {
    if (p[i].first == p[i + 1].first) {
      x[p[i].second] = -x[p[i].second];
    } else {
      if (d <= 0) {
        x[p[i + 1].second] = -x[p[i + 1].second];
        d += (p[i].first - p[i + 1].first);
      } else {
        d -= (p[i].first - p[i + 1].first);
        x[p[i].second] = -x[p[i].second];
      }
    }
  }
  if (n & 1) {
    x[p[n].second] = -x[p[n].second];
  }
}
double ang[200010];
bool cmp(int i, int j) { return ang[i] < ang[j]; }
int main() {
  init();
  scanf("%d", &n);
  int i, sum = 0;
  for (i = 1; i && cnt < n - 1; i++) {
    if (vis[i]) x[++cnt] = p[i].first, y[cnt] = p[i].second, sum += i;
  }
  int a, b, t = 0;
  for (int j = i; t < 2; j++) {
    if (vis[j]) {
      if (!t)
        a = j;
      else
        b = j;
      t++;
    }
  }
  int ok = 0;
  if ((sum + a) % 2 == 0)
    x[++cnt] = p[a].first, y[cnt] = p[a].second;
  else if ((sum + b) % 2 == 0)
    x[++cnt] = p[b].first, y[cnt] = p[b].second;
  else {
    x[++cnt] = p[a].first, y[cnt] = p[a].second;
    if (sum & 1)
      x[1] = p[b].first, y[1] = p[b].second;
    else
      x[3] = p[b].first, y[3] = p[b].second;
    ok = 1;
  }
  sum = 0;
  for (i = 1; i <= cnt; i++) sum += x[i];
  if (sum & 1) {
    if (!ok)
      swap(x[1], y[1]);
    else
      swap(x[4], y[4]);
  }
  get_sign(x);
  get_sign(y);
  for (int i = 1; i <= n; i++) ang[i] = atan2(y[i], x[i]);
  for (int i = 1; i <= n; i++) id[i] = i;
  sort(id + 1, id + n + 1, cmp);
  puts("YES");
  int tx = 0, ty = 0;
  for (int i = 1; i <= n; i++) {
    tx += x[id[i]], ty += y[id[i]];
    printf("%d %d\n", tx, ty);
  }
}