#include <bits/stdc++.h>
int const M = 1010000;
int const N = 10100;
int n;
int len[N];
int x[N];
int y[N];
int sq[M];
int perm[N];
double angle[N];
int resx[N];
int resy[N];
void filllens() {
  std::fill(sq, sq + M, -1);
  for (int i = 0; i * i < M; ++i) {
    sq[i * i] = i;
  }
  int last = 0;
  int sum = 0;
  for (int i = n - 1; i >= 0; --i) {
    while (x[i] == 0 && y[i] == 0) {
      len[i] = ++last;
      x[i] = 0;
      y[i] = 0;
      for (int q = 0; q * q <= len[i]; ++q) {
        if (sq[len[i] - q * q] != -1) {
          x[i] = q;
          y[i] = sq[len[i] - q * q];
          break;
        }
      }
    }
    sum += len[i];
  }
  if (sum % 2 == 1) {
    int xx = 0;
    int yy = 0;
    while (xx == 0 && yy == 0) {
      ++last;
      for (int q = 0; q * q <= last; ++q) {
        if (sq[last - q * q] != -1) {
          xx = q;
          yy = sq[last - q * q];
          break;
        }
      }
    }
    int i = 0;
    while (len[i] % 2 == last % 2) ++i;
    len[i] = last;
    x[i] = xx;
    y[i] = yy;
    for (; i > 0; --i) {
      std::swap(len[i], len[i - 1]);
      std::swap(x[i], x[i - 1]);
      std::swap(y[i], y[i - 1]);
    }
  }
}
void solve() {
  filllens();
  int sumx = 0;
  int sumy = 0;
  std::function<int(int, int)> len2 = [](int x, int y) {
    return x * x + y * y;
  };
  for (int i = 0; i < n; ++i) {
    int ax = x[i];
    int ay = y[i];
    for (int it = 0; it < 2; ++it) {
      for (int px : {-1, 1}) {
        for (int py : {-1, 1}) {
          if (len2(sumx + ax, sumy + ay) >
              len2(sumx + px * x[i], sumy + py * y[i])) {
            ax = px * x[i];
            ay = py * y[i];
          }
        }
      }
      std::swap(x[i], y[i]);
    }
    x[i] = ax;
    y[i] = ay;
    sumx += ax;
    sumy += ay;
  }
  assert(sumx == 0 && sumy == 0);
  for (int i = 0; i < n; ++i) {
    perm[i] = i;
    angle[i] = atan2(x[i], y[i]);
  }
  std::sort(perm, perm + n, [](int i, int j) { return angle[i] > angle[j]; });
  sumx = 0;
  sumy = 0;
  for (int i = 0; i < n; ++i) {
    resx[i] = sumx;
    resy[i] = sumy;
    sumx += x[perm[i]];
    sumy += y[perm[i]];
  }
}
void out() {
  puts("YES");
  for (int i = 0; i < n; ++i) {
    printf("%d %d\n", resx[i], resy[i]);
  }
}
int main() {
  scanf("%d", &n);
  solve();
  out();
}
