#include <bits/stdc++.h>
using namespace std;
template <class T>
T inline sqr(T x) {
  return x * x;
}
const int maxd = (int)1e6;
const int maxn = (int)1e4 + 10;
vector<pair<int, int> > v[maxd];
int rn, perm[maxn];
pair<int, int> r[maxn];
long double ang[maxn];
void Solve(int d) {
  for (int x = 1; x * x < d; x++)
    for (int y = 0; x * x + y * y < d && y <= x; y++)
      v[x * x + y * y].push_back(make_pair(x, y));
  int cnt = 0;
  for (int i = 0; i < (int)(d + 1); i++) cnt += (v[i].size() > 0);
}
bool aless(int i, int j) { return ang[i] < ang[j]; }
int main() {
  Solve(maxd);
  int n;
  scanf("%d", &n);
  {
    int d = 1, cnt = 0, d0 = (int)1e9;
    while (cnt < n) cnt += (v[d++].size() > 0);
    long long sum = 0;
    for (int pos = d - 1; pos > 0; pos--)
      if ((int)(v[pos]).size()) sum += (v[pos][0].first + v[pos][0].second);
    if (sum & 1) {
      int ind[2] = {-1, -1};
      for (int pos = 0; pos < (int)(d); pos++)
        if ((int)(v[pos]).size() > 0)
          ind[(v[pos][0].first + v[pos][0].second) & 1] = pos;
      d0 = d - 1;
      int skipped = 0;
      while (1) {
        if ((int)(v[d]).size() > 0 &&
            ind[!((v[d][0].first + v[d][0].second) & 1)]) {
          d0 = ind[!((v[d][0].first + v[d][0].second) & 1)];
          break;
        }
        skipped += ((int)(v[d]).size() > 0);
        d++;
      }
    } else
      d--;
    int dx = 0, dy = 0;
    for (int pos = d; pos > 0; pos--)
      if ((int)(v[pos]).size() && pos != d0) {
        int cx = v[pos][0].first;
        int cy = v[pos][0].second;
        int mi = (int)1e9, rx = 0, ry = 0;
        for (int t = 0; t < (int)(2); t++) {
          for (int kx = -1; kx <= 1; kx += 2)
            for (int ky = -1; ky <= 1; ky += 2) {
              int tmp, x = dx + cx * kx, y = dy + cy * ky;
              if (mi > (tmp = x * x + y * y)) mi = tmp, rx = x, ry = y;
            }
          swap(cx, cy);
        }
        r[rn++] = make_pair(rx - dx, ry - dy);
        dx = rx, dy = ry;
      }
    for (int i = 0; i < (int)(rn); i++)
      ang[i] = atan2((double)r[i].second, (double)r[i].first), perm[i] = i;
    sort(perm, perm + rn, aless);
    puts("YES");
    dx = 0, dy = 0;
    for (int i = 0; i < (int)(n); i++) {
      printf("%d %d\n", dx, dy);
      dx += r[perm[i]].first;
      dy += r[perm[i]].second;
    }
  }
  return 0;
}
