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 MAXN = 10005;
int N;
int len[MAXN], L;
inline long long sqr(long long a) { return a * a; }
inline int isSqr(long long num) {
  int lo = 0, hi = 1000000;
  while (lo < hi) {
    int mid = (hi + lo) >> 1;
    if (sqr(mid) < num) {
      lo = mid + 1;
    } else {
      hi = mid;
    }
  }
  return (sqr(hi) == num ? hi : -1);
}
inline bool good(int s) {
  for (int i = 0; i * i < s; i++) {
    if (isSqr(s - i * i) != -1) return true;
  }
  return false;
}
inline void check() {
  int sum = 0;
  for (int i = 0; i < N; i++) {
    sum = (sum + len[i]) & 1;
  }
  if (sum == 0) {
    return;
  }
  int ind = N - 1;
  while (ind >= 0 && (len[ind] & 1) == (len[N] & 1)) {
    ind--;
  }
  for (int i = ind; i < N; i++) {
    len[i] = len[i + 1];
  }
}
pair<double, pair<int, int> > output[MAXN];
int A;
pair<int, int> loc;
inline bool comp(pair<int, int> a, pair<int, int> b) {
  return (sqr(a.first) + sqr(a.second) < sqr(b.first) + sqr(b.second));
}
inline void add(int s) {
  int u = 0;
  while (isSqr(s - u * u) == -1) {
    u++;
  }
  int v = isSqr(s - u * u);
  vector<pair<int, int> > vec;
  vec.push_back(make_pair(loc.first + u, loc.second + v));
  vec.push_back(make_pair(loc.first + u, loc.second - v));
  vec.push_back(make_pair(loc.first - u, loc.second + v));
  vec.push_back(make_pair(loc.first - u, loc.second - v));
  vec.push_back(make_pair(loc.first + v, loc.second + u));
  vec.push_back(make_pair(loc.first + v, loc.second - u));
  vec.push_back(make_pair(loc.first - v, loc.second + u));
  vec.push_back(make_pair(loc.first - v, loc.second - u));
  sort(vec.begin(), vec.end(), comp);
  output[A].second =
      make_pair(vec[0].first - loc.first, vec[0].second - loc.second);
  output[A].first = atan2(output[A].second.second, output[A].second.first);
  A++;
  loc = vec[0];
}
inline bool comp2(pair<int, int> a, pair<int, int> b) {
  return (atan2(a.second, a.first) < atan2(b.second, b.first));
}
int main() {
  cin >> N;
  for (int i = 1; L <= N; i++) {
    if (good(i)) {
      len[L++] = i;
    }
  }
  L--;
  check();
  for (int i = N - 1; i >= 0; i--) {
    add(len[i]);
  }
  sort(output, output + N);
  int x = 0, y = 0;
  if (loc.first == 0 && loc.second == 0) {
    printf("YES\n");
    for (int i = 0; i < N; i++) {
      printf("%d %d\n", x, y);
      x += output[i].second.first;
      y += output[i].second.second;
    }
  } else {
    printf("NO\n");
  }
  return 0;
}