#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector")
using namespace std;
using namespace rel_ops;
using ll = int64_t;
using Vi = vector<int>;
using Pii = pair<int, int>;
void dbgx(...) {}
template <class T, class U = int, class... V>
void dbgx(T s, U a, V... b) {
  while (*s && *s != ',') cerr << *s++;
  cerr << ": " << a << *s++;
  dbgx(s, b...);
}
template <class T, class U = int, class... V>
auto operator<<(ostream& o, T x) -> decltype(&T::print, cout) {
  x.print();
  return o;
}
template <class T, class U = int, class... V>
auto operator<<(ostream& o, pair<T, U> x) -> decltype(0, cout) {
  return o << "(" << x.first << ", " << x.second << ")";
}
template <class T, class U = int, class... V>
auto operator<<(ostream& o, T x) -> decltype(T().begin(), cout) {
  o << "[";
  for (auto& e : (x)) o << e << ", ";
  return o << "]";
}
int n;
vector<Pii> swaps4, swaps5, swaps4x4;
Vi perm, stable;
vector<Pii> allSwaps, goodSwaps;
bool isIdent(const vector<Pii>& swaps, int len) {
  perm.resize(len);
  iota((perm).begin(), (perm).end(), 0);
  for (auto& x : (swaps)) swap(perm[x.first], perm[x.second]);
  for (int i = (0); i < (len); i++)
    if (perm[i] != i) return false;
  return true;
}
bool findIdent(int mask) {
  if (mask == 0) return true;
  for (int i = (0); i < (int((allSwaps).size())); i++)
    if ((mask >> i) & 1) {
      auto s = allSwaps[i];
      swap(perm[s.first], perm[s.second]);
      bool ok1 = (--stable[s.first] > 0 || perm[s.first] == s.first);
      bool ok2 = (--stable[s.second] > 0 || perm[s.second] == s.second);
      if (ok1 && ok2 && findIdent(mask & ~(1 << i))) {
        goodSwaps.push_back(s);
        return true;
      }
      stable[s.first]++;
      stable[s.second]++;
      swap(perm[s.first], perm[s.second]);
    }
  return false;
}
void makeIdent(vector<Pii>& swaps, int len) {
  allSwaps = swaps;
  goodSwaps.clear();
  perm.resize(len);
  stable.resize(len);
  iota((perm).begin(), (perm).end(), 0);
  fill((stable).begin(), (stable).end(), 0);
  for (auto& s : (swaps)) {
    stable[s.first]++;
    stable[s.second]++;
  }
  assert(findIdent((1 << int((swaps).size())) - 1));
  swaps = goodSwaps;
  assert(isIdent(swaps, len));
}
void initPerms() {
  for (int i = (0); i < (4); i++)
    for (int j = (i + 1); j < (4); j++) swaps4.push_back(make_pair(i, j));
  for (int i = (0); i < (5); i++)
    for (int j = (i + 1); j < (5); j++) swaps5.push_back(make_pair(i, j));
  for (int i = (0); i < (4); i++)
    for (int j = (4); j < (8); j++) swaps4x4.push_back(make_pair(i, j));
  makeIdent(swaps4, 4);
  makeIdent(swaps5, 5);
  makeIdent(swaps4x4, 8);
  ;
  ;
  ;
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(10);
  cin >> n;
  if ((n % 4) != 0 && (n % 4) != 1) {
    cout << "NO\n";
    return 0;
  }
  initPerms();
  cout << "YES\n";
  vector<Pii> final;
  for (int i = 0; i + 4 <= n; i += 4) {
    if ((n % 4) == 1) {
      for (auto& s : (swaps5))
        final.push_back({i + s.first, (s.second == 4 ? n - 1 : i + s.second)});
    } else {
      for (auto& s : (swaps4)) final.push_back({i + s.first, i + s.second});
    }
    for (int j = i + 4; j + 4 <= n; j += 4) {
      for (auto& s : (swaps4x4))
        final.push_back({i + s.first, j + s.second - 4});
    }
  }
  assert(isIdent(final, n));
  assert(int((final).size()) == n * (n - 1) / 2);
  ;
  for (auto& x : (final)) cout << x.first + 1 << " " << x.second + 1 << endl;
  return 0;
}
