#include <bits/stdc++.h>
using namespace std;
int const N = 1e3 + 41;
int const MAXPER = 72;
map<vector<int>, vector<pair<int, int>>> mem;
int n;
vector<vector<int>> comps;
vector<pair<int, int>> ans;
void bad() {
  printf("NO\n");
  exit(0);
}
void proc(vector<int> &p, vector<pair<int, int>> &ve, int cnt) {
  vector<int> per;
  vector<pair<int, int>> pe;
  for (int i = 0; i < cnt; ++i) per.push_back(i);
  for (int i = 0; i < (int)(p.size()); ++i) {
    int a = ve[p[i]].first;
    int b = ve[p[i]].second;
    pe.push_back(make_pair(a, b));
    swap(per[a], per[b]);
  }
  mem[per] = pe;
}
void precalc(int cnt) {
  vector<int> p;
  vector<pair<int, int>> ve;
  for (int i = 0; i < cnt; ++i)
    for (int j = i + 1; j < cnt; ++j)
      p.push_back((int)(ve.size())), ve.push_back(make_pair(i, j));
  do {
    proc(p, ve, cnt);
  } while ((int)(mem.size()) < 72 && next_permutation(p.begin(), p.end()));
}
int getMin(vector<int> &a) {
  int ret = a[0];
  for (int i = 0; i < (int)(a.size()); ++i) ret = min(ret, a[i]);
  return ret;
}
void pushMerge(vector<int> &a, vector<int> &b) {
  int minA = getMin(a);
  int minB = getMin(b);
  if ((int)(a.size()) == (int)(b.size())) {
    assert((int)(a.size()) == 4);
    for (int i = 0; i < 4; ++i)
      for (int j = 0; j < 4; ++j) {
        int u = j;
        int v = (j + i) % 4;
        ans.push_back(make_pair(u + minA, v + minB));
        swap(a[j], b[v]);
      }
  } else {
    assert((int)(b.size()) == 5);
    for (int i = 0; i < 4; ++i) {
      int u = i;
      int v = i;
      ans.push_back(make_pair(u + minA, v + minB));
      swap(a[i], b[i]);
    }
    for (int i = 4 - 1; i >= 0; --i) {
      int u = i;
      int v = 4;
      swap(a[i], b[v]);
      ans.push_back(make_pair(u + minA, v + minB));
    }
    for (int i = 1; i < 4; ++i)
      for (int j = 0; j < 4; ++j) {
        int u = j;
        int v = (j + i) % 4;
        ans.push_back(make_pair(u + minA, v + minB));
        swap(a[j], b[v]);
      }
  }
}
void pushComp(vector<int> &a) {
  int minA = getMin(a);
  for (int i = 0; i < (int)(a.size()); ++i) a[i] -= minA;
  assert(mem.find(a) != mem.end());
  vector<pair<int, int>> rev = mem[a];
  for (int i = 0; i < (int)(a.size()); ++i) a[i] += minA;
  for (int i = (int)(rev.size()) - 1; i >= 0; --i) {
    ans.push_back(make_pair(rev[i].first + minA, rev[i].second + minA));
    swap(a[rev[i].first], a[rev[i].second]);
  }
}
void checkAns() {
  vector<int> a;
  for (int i = 1; i < n + 1; ++i) a.push_back(i);
  vector<int> b = a;
  for (int i = 0; i < (int)(ans.size()); ++i) {
    int u = ans[i].first - 1;
    int v = ans[i].second - 1;
    swap(a[u], a[v]);
  }
  assert(a == b);
}
void solve() {
  scanf("%d", &n);
  if (n == 1) {
    printf("YES\n");
    return;
  }
  if (n % 4 == 0) {
    for (int i = 1; i <= n; i += 4) {
      vector<int> c;
      for (int j = 0; j < 4; ++j) c.push_back(i + j);
      comps.push_back(c);
    }
  } else if ((n - 5) % 4 == 0) {
    --n;
    for (int i = 1; i <= n; i += 4) {
      vector<int> c;
      for (int j = 0; j < 4; ++j) c.push_back(i + j);
      comps.push_back(c);
    }
    ++n;
    comps.back().push_back(n);
  } else {
    bad();
  }
  precalc(4);
  precalc(5);
  for (int i = 0; i < (int)(comps.size()); ++i)
    for (int j = i + 1; j < (int)(comps.size()); ++j)
      pushMerge(comps[i], comps[j]);
  for (int i = 0; i < (int)(comps.size()); ++i) pushComp(comps[i]);
  printf("YES\n");
  for (int i = 0; i < (int)(ans.size()); ++i) {
    if (ans[i].first > ans[i].second) swap(ans[i].first, ans[i].second);
    printf("%d %d\n", ans[i].first, ans[i].second);
  }
  checkAns();
}
int main() {
  solve();
  return 0;
}
