#include <bits/stdc++.h>
using namespace std;
struct pt {
  long long x, y;
  pt operator+(const pt& other) const { return {x + other.x, y + other.y}; }
  int halfplane() const {
    if (y > 0) {
      return 0;
    }
    if (y == 0 && x > 0) {
      return 0;
    }
    return 1;
  }
};
long long cross(const pt& p, const pt& q) { return p.x * q.y - p.y * q.x; }
bool operator<(const pt& p, const pt& q) {
  if (p.halfplane() != q.halfplane()) {
    return p.halfplane() < q.halfplane();
  }
  return cross(p, q) > 0;
}
struct datum {
  long long c;
  long long x, y;
  bool operator<(const datum& other) const { return c < other.c; }
  bool operator==(const datum& other) const { return c == other.c; }
};
long long len2(const pt& p) { return p.x * p.x + p.y * p.y; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<datum> vct;
  for (long long d = 1; (int)(vct).size() <= n + 30; ++d) {
    for (long long x = 0; x * x <= d; ++x) {
      long long y = sqrt(d - x * x);
      if (x * x + y * y == d) {
        vct.push_back({d, x, y});
        break;
      }
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    if (vct[i].c & 1) {
      ++cnt;
    }
  }
  if (cnt & 1) {
    vector<datum> res;
    vector<int> rem;
    if (vct[n].c & 1) {
      rem = {1, 0};
    } else {
      rem = {0, 1};
    }
    for (int r : rem) {
      for (int i = 0; i <= n; ++i) {
        if (vct[i].c % 2 == r && (int)(res).size() < n) {
          res.push_back(vct[i]);
        }
      }
    }
    vct.swap(res);
  } else {
    while ((int)(vct).size() > n) {
      vct.pop_back();
    }
  }
  sort((vct).begin(), (vct).end());
  assert((int)(vct).size() == n);
  cnt = 0;
  for (int i = 0; i < n; ++i) {
    if (vct[i].c & 1) {
      ++cnt;
    }
  }
  assert(cnt % 2 == 0);
  const long long inf = 1e9;
  pt curr = {0, 0};
  reverse((vct).begin(), (vct).end());
  vector<pt> dir;
  vector<bool> used(n, false);
  for (int i = 0; i < n; ++i) {
    pt opt = {inf, inf};
    {
      long long x = vct[i].x, y = vct[i].y;
      for (int sw = 0; sw < 2; ++sw) {
        for (int a = -1; a <= 1; a += 2) {
          for (int b = -1; b <= 1; b += 2) {
            pt p = {a * x, b * y};
            if (sw) {
              swap(p.x, p.y);
            }
            if (len2(curr + p) < len2(curr + opt)) {
              opt = p;
            }
          }
        }
      }
      dir.push_back(opt);
      curr = curr + opt;
    }
  }
  sort((dir).begin(), (dir).end());
  curr = {0, 0};
  cout << "YES\n";
  for (int i = 0; i < n; ++i) {
    cout << curr.x << " " << curr.y << "\n";
    curr = curr + dir[i];
  }
}
