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:16777216")
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
int n;
int m;
const int mlen = 800;
vector<pair<int, int> > v;
vector<pair<int, int> > use;
int get(pair<int, int> x) {
  return ((x.first) * (x.first)) + ((x.second) * (x.second));
}
bool l1(pair<int, int> a, pair<int, int> b) { return get(a) < get(b); }
bool l2(int a, int b) { return v[a].first > v[b].first; }
bool l3(int a, int b) { return v[a].second > v[b].second; }
bool l4(int a, int b) {
  double tmp = atan2(v[a].first, v[a].second) - atan2(v[b].first, v[b].second);
  if (abs(tmp) > 1e-8) {
    return tmp > 0;
  } else
    return get(v[a]) > get(v[b]);
}
int id[10000], ox[10000], oy[10000];
int main() {
  cin >> n;
  for (int x = 1; x <= min(mlen, n + 2); x++)
    for (int y = 0; y < (x + 1); y++) v.push_back(make_pair(x, y));
  sort((v).begin(), (v).end(), l1);
  vector<pair<int, int> > vv;
  vv.push_back(v[0]);
  for (int i = 1; i < ((int)(v).size()); i++)
    if (get(v[i]) != get(v[i - 1])) vv.push_back(v[i]);
  v = vv;
  int sx, sy;
  sx = sy = 0;
  for (int i = 0; i < (n); i++) {
    sx += v[i].first;
    sy += v[i].second;
  }
  if (sx % 2 && sy % 2) {
    swap(v[0].first, v[0].second);
  } else if (sx % 2 || sy % 2) {
    sx += v[n].first;
    sy += v[n].second;
    if (sx % 2 && sy % 2) swap(v[n], v[1]);
    if (sx % 2 && sy % 2 == 0) swap(v[n], v[0]);
    if (sx % 2 == 0 && sy % 2) swap(v[n], v[3]);
    if (sx % 2 == 0 && sy % 2 == 0) swap(v[n], v[2]);
  }
  for (int i = 0; i < (n); i++) id[i] = i;
  sort(id, id + n, l2);
  int cx = 0;
  for (int i = 0; i < (n); i++) {
    if (cx <= 0)
      ox[id[i]] = 1;
    else
      ox[id[i]] = -1;
    cx += ox[id[i]] * v[id[i]].first;
  }
  for (int i = 0; i < (n); i++) id[i] = i;
  sort(id, id + n, l3);
  int cy = 0;
  for (int i = 0; i < (n); i++) {
    if (cy <= 0)
      oy[id[i]] = 1;
    else
      oy[id[i]] = -1;
    cy += oy[id[i]] * v[id[i]].second;
  }
  for (int i = 0; i < (n); i++) {
    v[i].first *= ox[i];
    v[i].second *= oy[i];
  }
  for (int i = 0; i < (n); i++) id[i] = i;
  sort(id, id + n, l4);
  cx = cy = 0;
  cout << "YES" << endl;
  for (int i = 0; i < (n); i++) {
    cout << cx << ' ' << cy << endl;
    cx += v[id[i]].first;
    cy += v[id[i]].second;
  }
  return 0;
}