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;
set<int> sq;
set<int>::iterator it;
vector<pair<int, pair<int, int> > > r;
vector<pair<int, int> > v, res;
int n, sum;
int ansx, ansy;
int sx, sy;
pair<int, int> d[4] = {{1, 1}, {-1, 1}, {1, -1}, {-1, -1}};
bool ok(int cur) {
  for (it = sq.begin(); it != sq.end(); it++) {
    if (*it > cur) return 0;
    if (sq.count(cur - *it)) {
      r.push_back(make_pair(cur, make_pair(sqrt(*it), sqrt(cur - *it))));
      return 0;
    }
  }
}
bool cmp2(pair<int, int> a, pair<int, int> b) {
  return atan2(a.second, a.first) < atan2(b.second, b.first) - 1e-6;
}
bool cmp(pair<int, int> a, pair<int, int> b) {
  return a.first * a.first + a.second * a.second >
         b.first * b.first + b.second * b.second;
}
int main() {
  cin >> n;
  for (int i = 0; i < 500; i++) sq.insert(i * i);
  int cur = 1;
  while (r.size() <= n + 1) ok(cur++);
  for (int i = 0; i < n; i++) sum += r[i].second.first + r[i].second.second;
  if (sum % 2) {
    sum += r[n].second.first + r[n].second.second;
    v.push_back(make_pair(r[n].second.first, r[n].second.second));
    int first = 1;
    for (int i = n - 1; i >= 0; i--) {
      if ((r[i].second.first + r[i].second.second) % 2 == sum % 2 && first) {
        first = 0;
        continue;
      }
      v.push_back(make_pair(r[i].second.first, r[i].second.second));
    }
  } else
    for (int i = 0; i < n; i++)
      v.push_back(make_pair(r[i].second.first, r[i].second.second));
  sort(v.begin(), v.end(), &cmp);
  for (int i = 0; i < v.size(); i++) {
    int x = v[i].first;
    int y = v[i].second;
    int resx, resy;
    int dif = 100000;
    for (int j = 0; j < 4; j++)
      if (abs(sx - x * d[j].first) + abs(sy - y * d[j].second) < dif) {
        dif = abs(sx - x * d[j].first) + abs(sy - y * d[j].second);
        resx = x * d[j].first;
        resy = y * d[j].second;
      }
    swap(x, y);
    for (int j = 0; j < 4; j++)
      if (abs(sx - x * d[j].first) + abs(sy - y * d[j].second) < dif) {
        dif = abs(sx - x * d[j].first) + abs(sy - y * d[j].second);
        resx = x * d[j].first;
        resy = y * d[j].second;
      }
    res.push_back(make_pair(resx, resy));
    sx -= resx;
    sy -= resy;
  }
  sort(res.begin(), res.end(), &cmp2);
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) {
    cout << ansx << " " << ansy << endl;
    ansx += res[i].first;
    ansy += res[i].second;
  }
}