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>
#pragma comment(linker, "/STACK:32000000")
using namespace std;
struct S {
  int x, y;
  S(int x, int y) : x(x), y(y) {}
  friend bool operator<(const S &a, const S &b) {
    return a.x * a.x + a.y * a.y < b.x * b.x + b.y * b.y;
  }
  friend bool operator==(const S &a, const S &b) {
    return a.x * a.x + a.y * a.y == b.x * b.x + b.y * b.y;
  }
};
int n;
vector<S> w;
bool test(vector<pair<int, int> > &a) {
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  int s = 0;
  int n = ((int)a.size());
  for (int i = 0; i + 10 < n; i++) {
    if (s <= 0)
      s += a[i].first;
    else {
      s -= a[i].first;
      a[i].first *= -1;
    }
  }
  int k = min(10, n);
  for (int i = 0; i < (1 << k); i++) {
    int t = 0;
    for (int j = 0; j < k; j++)
      if (i & (1 << j))
        t -= a[n - 1 - j].first;
      else
        t += a[n - 1 - j].first;
    if (t == -s) {
      for (int j = 0; j < k; j++)
        if (i & (1 << j)) a[n - 1 - j].first *= -1;
      return true;
    }
  }
  return false;
}
bool cmp(const S &a, const S &b) {
  double u = atan2((double)a.y, (double)a.x);
  double v = atan2((double)b.y, (double)b.x);
  return u < v;
}
void solve() {
  scanf("%d", &n);
  for (int x = 0; x <= 170; x++)
    for (int y = 0; y < x; y++) w.push_back(S(x, y));
  sort(w.begin(), w.end());
  w.erase(unique(w.begin(), w.end()), w.end());
  int i = n;
  vector<S> a = w;
  int sumx = 0;
  int sumy = 0;
  for (int j = 0; j < i; j++) {
    sumx += a[j].x;
    sumy += a[j].y;
  }
  if (sumx % 2 != sumy % 2) {
    sumx = (sumx + a[i].x) % 2;
    sumy = (sumy + a[i].y) % 2;
    for (int j = 0; j < n; j++)
      if ((sumx + a[j].x) % 2 == (sumy + a[j].y) % 2) {
        swap(a[j], a[i]);
        break;
      }
    sumx = 0;
    sumy = 0;
    for (int j = 0; j < i; j++) {
      sumx += a[j].x;
      sumy += a[j].y;
    }
    if (sumx % 2 != sumy % 2) {
      throw 42;
    }
  }
  if (sumx % 2 == 1 && sumy % 2 == 1) {
    bool ok = false;
    for (int j = 0; j < n; j++)
      if (a[j].x % 2 != a[j].y % 2) {
        swap(a[j].x, a[j].y);
        ok = true;
        break;
      }
    if (!ok) {
      throw 42;
    }
  }
  vector<pair<int, int> > t;
  for (int j = 0; j < i; j++) t.push_back(make_pair(a[j].x, j));
  test(t);
  for (int j = 0; j < i; j++) a[t[j].second].x = t[j].first;
  t.clear();
  for (int j = 0; j < i; j++) t.push_back(make_pair(a[j].y, j));
  test(t);
  for (int j = 0; j < i; j++) a[t[j].second].y = t[j].first;
  {
    int sx = 0, sy = 0;
    for (int j = 0; j < i; j++) sx += a[j].x, sy += a[j].y;
    if (sx != 0 || sy != 0) throw 42;
  }
  int x = 0, y = 0;
  sort(a.begin(), a.begin() + i, cmp);
  printf("YES\n");
  for (int j = 0; j < i; j++) {
    printf("%d %d\n", x, y);
    x += a[j].x;
    y += a[j].y;
  }
}
int main() {
  solve();
  return 0;
}