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 double eps = 1e-9;
const int MAXSQN = 200;
vector<pair<int, int> > v, ansv;
int sqr(int x) { return x * x; }
int vlen(int x, int y) { return sqr(x) + sqr(y); }
int vlen(pair<int, int> p) { return vlen(p.first, p.second); }
bool comp0(pair<int, int> p0, pair<int, int> p1) { return vlen(p0) < vlen(p1); }
bool comp1(pair<int, int> p0, pair<int, int> p1) {
  return atan2(p0.second + eps, p0.first + eps) <
         atan2(p1.second + eps, p1.first + eps);
}
int main() {
  int n, sum0;
  pair<int, int> prepair, nowv;
  cin >> n;
  for (int i = 0; i <= MAXSQN; i++)
    for (int j = i; j <= MAXSQN; j++)
      if (i > 0 || j > 0) v.push_back(make_pair(i, j));
  sort(v.begin(), v.end(), comp0);
  prepair.first = -1;
  for (vector<pair<int, int> >::iterator iter = v.begin(); iter != v.end();)
    if (prepair.first >= 0 && vlen(prepair) == vlen(*iter))
      iter = v.erase(iter);
    else
      prepair = *iter, iter++;
  sum0 = 0;
  for (int i = 0; i < n; i++) sum0 += v[i].first + v[i].second;
  if (sum0 % 2 == 1) {
    int tem = (sum0 + v[n].first + v[n].second) % 2;
    for (int i = n - 1; i >= 0; i--)
      if ((v[i].first + v[i].second) % 2 == tem) {
        v.erase(v.begin() + i);
        break;
      }
  }
  nowv.first = nowv.second = 0;
  for (int i = n - 1; i >= 0; i--) {
    pair<int, int> dire, minv;
    minv.first = minv.second = 10000;
    for (int x = -1; x <= 1; x += 2)
      for (int y = -1; y <= 1; y += 2)
        for (int z = 0; z < 2; z++) {
          if (vlen(nowv.first + v[i].first * x, nowv.second + v[i].second * y) <
              vlen(minv)) {
            minv.first = nowv.first + v[i].first * x;
            minv.second = nowv.second + v[i].second * y;
            dire.first = v[i].first * x;
            dire.second = v[i].second * y;
          }
          swap(v[i].first, v[i].second);
        }
    nowv = minv;
    ansv.push_back(dire);
  }
  sort(ansv.begin(), ansv.end(), comp1);
  nowv.first = nowv.second = 0;
  printf("YES\n");
  for (int i = 0; i < n; i++) {
    printf("%d %d\n", nowv.first, nowv.second);
    nowv.first += ansv[i].first;
    nowv.second += ansv[i].second;
  }
  return 0;
}