#include <bits/stdc++.h>
using namespace std;
void model(vector<int>& a, const vector<pair<int, int> >& v) {
  for (pair<int, int> p : v) swap(a[p.first], a[p.second]);
}
bool check(int n, const vector<pair<int, int> >& v) {
  vector<int> a(n);
  for (int i = 0; i < n; ++i) a[i] = i;
  model(a, v);
  for (int i = 0; i < n; ++i)
    if (a[i] != i) return false;
  return true;
}
vector<pair<int, int> > sol0, sol1;
void solve(int n, vector<pair<int, int> >& res) {
  if (n < 4) return;
  solve(n - 4, res);
  for (int i = 0; i + 1 < n - 4; i += 2) {
    res.push_back(pair<int, int>(i, n - 4));
    res.push_back(pair<int, int>(i + 1, n - 3));
    res.push_back(pair<int, int>(i + 1, n - 4));
    res.push_back(pair<int, int>(i, n - 3));
    res.push_back(pair<int, int>(i, n - 2));
    res.push_back(pair<int, int>(i + 1, n - 1));
    res.push_back(pair<int, int>(i + 1, n - 2));
    res.push_back(pair<int, int>(i, n - 1));
  }
  if (n % 2) {
    res.push_back(pair<int, int>(n - 5, n - 4));
    res.push_back(pair<int, int>(n - 5, n - 3));
    res.push_back(pair<int, int>(n - 5, n - 2));
    res.push_back(pair<int, int>(n - 4, n - 1));
    res.push_back(pair<int, int>(n - 5, n - 1));
    for (pair<int, int> p : sol1) {
      res.push_back(pair<int, int>(p.first + n - 4, p.second + n - 4));
    }
  } else {
    for (pair<int, int> p : sol0) {
      res.push_back(pair<int, int>(p.first + n - 4, p.second + n - 4));
    }
  }
  assert(res.size() == n * (n - 1) / 2);
}
void solve0() {
  vector<pair<int, int> > v;
  for (int i = 0; i < 4; ++i)
    for (int j = i + 1; j < 4; ++j) v.push_back(pair<int, int>(i, j));
  do {
    if (check(4, v)) {
      sol0 = v;
      break;
    }
  } while (next_permutation(v.begin(), v.end()));
  assert(!sol0.empty());
}
void solve1() {
  vector<pair<int, int> > v;
  for (int i = 0; i < 4; ++i)
    for (int j = i + 1; j < 4; ++j)
      if (pair<int, int>(i, j) != pair<int, int>(0, 3))
        v.push_back(pair<int, int>(i, j));
  do {
    vector<int> st = {3, 0, 1, 2};
    vector<int> en = {0, 1, 2, 3};
    model(st, v);
    if (st == en) {
      sol1 = v;
      break;
    }
  } while (next_permutation(v.begin(), v.end()));
  assert(!sol1.empty());
}
int main() {
  std::ios::sync_with_stdio(false);
  solve0();
  solve1();
  int n;
  cin >> n;
  if (n * (n - 1) / 2 % 2) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  vector<pair<int, int> > res;
  solve(n, res);
  for (int i = 0; i < res.size(); ++i) {
    cout << min(res[i].first, res[i].second) + 1 << " "
         << max(res[i].first, res[i].second) + 1 << endl;
  }
  return 0;
}
