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 INF = 0x3fffffff;
const long long _INF = 0x7ffffffffffffffll;
const double EPS = 1e-9;
const double PI = acos(-1.0);
template <class T, class INT>
inline T pow(T x, INT y) {
  T res(1);
  for (T tt(x); y; y /= 2) {
    if (y & 1) res *= tt;
    tt *= tt;
  }
  return res;
}
template <class T, class INT>
inline T pow(T x, INT y, T p) {
  T res(1);
  for (T tt(x); y; y /= 2) {
    if (y & 1) res = res * tt % p;
    tt = tt * tt % p;
  }
  return res;
}
int toInt(string s) {
  int x = 0;
  istringstream sin(s);
  sin >> x;
  return x;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
template <class INT>
inline INT gcd(INT x, INT y) {
  return y ? gcd(y, x % y) : x;
}
template <class INT>
inline int calc_bits(INT x) {
  return x ? (x & 1) + calc_bits(x >> 1) : 0;
}
const int MAXD = 80000 + 10;
const int MAXM = 200 + 1;
int tmp, sumx, sumy, cnt, n;
vector<pair<int, int> > a;
bool check[MAXD];
struct Graph {
  int head[MAXM], next[MAXD], vis[MAXD], tot;
  inline void add(int u, int v) {
    next[++tot] = head[u];
    vis[head[u] = tot] = v;
  }
} x, y;
inline int abs(pair<int, int> a) {
  return ((a.first) * (a.first)) + ((a.second) * (a.second));
}
inline bool cmp(pair<int, int> a, pair<int, int> b) {
  return atan2(a.second, a.first) < atan2(b.second, b.first) - EPS;
}
inline bool _cmp(pair<int, int> a, pair<int, int> b) { return abs(a) < abs(b); }
int main(int argc, char* argv[]) {
  for (int i = 0; i < (MAXM); ++i)
    for (int j = 0; j < (MAXM); ++j) {
      tmp = abs(pair<int, int>(i, j));
      if (!check[tmp]) check[tmp] = true, a.push_back(pair<int, int>(i, j));
    }
  cin >> n;
  sort((a).begin(), (a).end(), _cmp);
  for (int i = 0; i < (n + 1); ++i) sumx += a[i].first, sumy += a[i].second;
  if (sumx + sumy & 1) {
    sumx += a[n + 1].first, sumy += a[n + 1].second;
    for (int i = (n); i > (0); --i)
      if (!(sumx - a[i].first & 1) && !(sumy - a[i].second & 1)) {
        swap(a[i], a[n + 1]);
        break;
      }
  } else if (sumx & 1)
    for (int i = (1); i < (n + 1); ++i)
      if (a[i].first + a[i].second & 1) {
        swap(a[i].first, a[i].second);
        break;
      }
  for (int i = (1); i < (n + 1); ++i)
    x.add(a[i].first, i), y.add(a[i].second, i);
  for (int i = (200); i > (0); --i)
    for (int j = x.head[i]; j; j = x.next[j])
      if (cnt > 0)
        a[x.vis[j]].first = -a[x.vis[j]].first, cnt -= i;
      else
        cnt += i;
  for (int i = (200); i > (0); --i)
    for (int j = y.head[i]; j; j = y.next[j])
      if (cnt > 0)
        a[y.vis[j]].second = -a[y.vis[j]].second, cnt -= i;
      else
        cnt += i;
  sort(a.begin() + 1, a.begin() + n + 1, cmp);
  sumx = sumy = 0;
  cout << "YES" << endl;
  for (int i = (1); i < (n + 1); ++i) {
    cout << sumx << " " << sumy << endl;
    sumx += a[i].first, sumy += a[i].second;
  }
}