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 prodvec(pair<int, int> p1, pair<int, int> p2) {
  return p1.first * p2.second - p1.second * p2.first;
}
pair<int, int> operator+(pair<int, int> p1, pair<int, int> p2) {
  return pair<int, int>(p1.first + p2.first, p1.second + p2.second);
}
pair<int, int> operator-(pair<int, int> p1, pair<int, int> p2) {
  return pair<int, int>(p1.first - p2.first, p1.second - p2.second);
}
pair<int, int> q2(pair<int, int> p) {
  return pair<int, int>(-p.first, p.second);
}
pair<int, int> q3(pair<int, int> p) {
  return pair<int, int>(-p.first, -p.second);
}
pair<int, int> q4(pair<int, int> p) {
  return pair<int, int>(p.first, -p.second);
}
int norm(pair<int, int> p) {
  if (p.first * p.first + p.second * p.second > 1000000000) {
    cout << "pifia1" << endl;
    exit(0);
  }
  return p.first * p.first + p.second * p.second;
}
bool compara(pair<int, int> p1, pair<int, int> p2) {
  return norm(p1) < norm(p2);
}
bool comparaangulo(pair<int, int> p1, pair<int, int> p2) {
  if ((p1.first == 0 and p1.second == 0) or
      (p2.first == 0 and p2.second == 0)) {
    cout << "pifia2" << endl;
    exit(0);
  }
  if (p1.second < 0 or (p1.second == 0 and p1.first < 0)) {
    if (p2.second < 0 or (p2.second == 0 and p2.first < 0))
      return prodvec(p1, p2) > 0;
    else
      return true;
  } else if (p2.second < 0 or (p2.second == 0 and p2.first < 0)) {
    return false;
  } else
    return prodvec(p1, p2) > 0;
}
vector<vector<pair<int, int> > > v;
bool camino(int iv, pair<int, int> p, vector<pair<int, int> > &sol) {
  if (iv == -1) return p.first == 0 and p.second == 0;
  vector<pair<int, int> > &w = v[iv];
  for (int i = 0; i < int(w.size()); i++) {
    sol[iv] = w[i];
    if (camino(iv - 1, p + w[i], sol)) return true;
    sol[iv] = q2(w[i]);
    if (camino(iv - 1, p + q2(w[i]), sol)) return true;
    sol[iv] = q3(w[i]);
    if (camino(iv - 1, p + q3(w[i]), sol)) return true;
    sol[iv] = q4(w[i]);
    if (camino(iv - 1, p + q4(w[i]), sol)) return true;
  }
  return false;
}
vector<pair<int, int> > camino(int iv, pair<int, int> p) {
  vector<pair<int, int> > sol(iv + 1);
  if (not camino(iv, p, sol)) {
    cout << "pifia3" << endl;
    exit(0);
  }
  return sol;
}
int main() {
  int n;
  cin >> n;
  int r = 200;
  map<int, vector<pair<int, int> > > mapa;
  for (int i = 0; i <= r; i++)
    for (int j = 0; j <= r; j++)
      if (i != 0 or j != 0) mapa[i * i + j * j].push_back(pair<int, int>(i, j));
  for (map<int, vector<pair<int, int> > >::iterator it = mapa.begin();
       it != mapa.end(); it++)
    v.push_back(it->second);
  int suma = 0;
  int iimpar;
  int ipar;
  for (int i = 0; i < n; i++) {
    suma += norm(v[i][0]);
    if (norm(v[i][0]) % 2)
      iimpar = i;
    else
      ipar = i;
  }
  if (suma % 2) {
    if (norm(v[n][0]) % 2)
      for (; ipar < n; ipar++) swap(v[ipar], v[ipar + 1]);
    else
      for (; iimpar < n; iimpar++) swap(v[iimpar], v[iimpar + 1]);
  }
  vector<pair<int, int> > sol;
  pair<int, int> p = v[n - 1][0];
  sol.push_back(p);
  if (sol.back().first == 0 and sol.back().second == 0) {
    cout << "pifia6" << endl;
    exit(0);
  }
  {
    int i = n - 2;
    for (; i >= 7; i--) {
      vector<pair<int, int> > &w = v[i];
      vector<pair<int, int> > nextp;
      for (int j = 0; j < int(w.size()); j++) {
        nextp.push_back(p + w[j]);
        nextp.push_back(p + q2(w[j]));
        nextp.push_back(p + q3(w[j]));
        nextp.push_back(p + q4(w[j]));
      }
      sort(nextp.begin(), nextp.end(), compara);
      sol.push_back(nextp[0] - p);
      if (sol.back().first == 0 and sol.back().second == 0) {
        cout << "pifia4" << endl;
        exit(0);
      }
      p = nextp[0];
    }
    vector<pair<int, int> > solaux = camino(i, p);
    for (int j = 0; j < int(solaux.size()); j++) {
      sol.push_back(solaux[j]);
      if (sol.back().first == 0 and sol.back().second == 0) {
        cout << "pifia5" << endl;
        exit(0);
      }
    }
  }
  for (int i = 0; i < int(sol.size()); i++) {
    if (sol[i].first == 0 and sol[i].second == 0) {
      cout << "pifia7" << endl;
      exit(0);
    }
  }
  sort(sol.begin(), sol.end(), comparaangulo);
  p = pair<int, int>(0, 0);
  cout << "YES" << endl;
  for (int i = 0; i < int(sol.size()); i++) {
    cout << p.first << " " << p.second << endl;
    p = p + sol[i];
  }
}