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;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
int n;
int m;
vector<pair<int, int> > v;
pair<int, int> w[10000];
bool l1(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;
}
bool l2(pair<int, int> a, pair<int, int> b) {
  return atan2(a.second + .0, a.first + .0) <
         atan2(b.second + .0, b.first + .0) - 1e-5;
}
int main() {
  scanf("%d", &n);
  for (int a = 0; a < 200; a++)
    for (int b = 1; b < 200; b++) v.push_back(make_pair(a, b));
  sort((v).begin(), (v).end(), l1);
  int r = 0;
  for (int i = 0; i < ((int)(v).size()); i++)
    if (i == 0 || l1(v[i - 1], v[i])) v[r++] = v[i];
  int s = 0;
  for (int i = 0; i < n; i++) s += v[i].first + v[i].second;
  if (s & 1)
    for (int i = n - 1; i >= 0; i--)
      if (((v[i].first + v[i].second) & 1) !=
          ((v[n].first + v[n].second) & 1)) {
        for (int j = i; j < n; j++) v[j] = v[j + 1];
        break;
      }
  int sx = 0, sy = 0;
  for (int i = n - 1; i >= 0; i--) {
    int nx = 1e9, ny = 1e9;
    for (int p = 1; p >= -1; p -= 2)
      for (int q = 1; q >= -1; q -= 2) {
        int mx = sx + v[i].first * p, my = sy + v[i].second * q;
        if ((long long)mx * mx + (long long)my * my <
            (long long)nx * nx + (long long)ny * ny) {
          w[i].first = v[i].first * p;
          w[i].second = v[i].second * q;
          nx = mx;
          ny = my;
        }
        mx = sx + v[i].second * p;
        my = sy + v[i].first * q;
        if ((long long)mx * mx + (long long)my * my <
            (long long)nx * nx + (long long)ny * ny) {
          w[i].first = v[i].second * p;
          w[i].second = v[i].first * q;
          nx = mx;
          ny = my;
        }
      }
    sx += w[i].first;
    sy += w[i].second;
  }
  sort(w, w + n, l2);
  printf("YES\n");
  int x = 0, y = 0;
  for (int i = 0; i < n; i++) {
    printf("%d %d\n", x, y);
    x += w[i].first;
    y += w[i].second;
  }
  return 0;
}