#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int maxn = 3e6;
const long long mod = 1e9 + 7;
long long pw(long long a, long long b, long long md = mod) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res = (a * res) % md;
    }
    a = (a * a) % md;
    b >>= 1;
  }
  return (res);
}
int n;
vector<pair<int, int> > perm = {pair<int, int>(1, 2), pair<int, int>(1, 3),
                                pair<int, int>(2, 4), pair<int, int>(1, 4),
                                pair<int, int>(2, 3), pair<int, int>(3, 4)};
vector<pair<int, int> > Germ = {
    pair<int, int>(5, 1), pair<int, int>(6, 1), pair<int, int>(7, 1),
    pair<int, int>(8, 2), pair<int, int>(5, 3), pair<int, int>(5, 2),
    pair<int, int>(6, 4), pair<int, int>(5, 4), pair<int, int>(6, 2),
    pair<int, int>(8, 3), pair<int, int>(7, 3), pair<int, int>(6, 3),
    pair<int, int>(7, 2), pair<int, int>(8, 1), pair<int, int>(8, 4),
    pair<int, int>(7, 4)};
vector<pair<int, int> > Term = {pair<int, int>(1, 2), pair<int, int>(1, 3),
                                pair<int, int>(2, 3), pair<int, int>(1, 4),
                                pair<int, int>(2, 5), pair<int, int>(3, 5),
                                pair<int, int>(1, 5), pair<int, int>(3, 4),
                                pair<int, int>(2, 4), pair<int, int>(4, 5)};
void apply(int x) {
  for (auto [u, v] : perm) cout << u + x - 1 << ' ' << v + x - 1 << '\n';
}
void Apply(int x) {
  for (auto [u, v] : Term)
    cout << u + x - 1 << ' ' << ((v == 5) ? n : v + x - 1) << '\n';
}
void apply(int x, int y) {
  for (auto [u, v] : Germ) cout << v + x - 1 << ' ' << u + y - 5 << '\n';
}
int32_t main() {
  cin.tie(0)->sync_with_stdio(0);
  cin >> n;
  if (n % 4 == 3 or n % 4 == 2) cout << "NO", exit(0);
  cout << "YES" << '\n';
  if (n % 4 == 0) {
    for (int i = 1; i + 3 <= n; i += 4) apply(i);
    for (int i = 1; i + 3 <= n; i += 4)
      for (int j = 1; j < i; j += 4) apply(j, i);
  } else {
    for (int i = 1; i + 3 <= n; i += 4) Apply(i);
    for (int i = 1; i + 3 <= n; i += 4)
      for (int j = 1; j < i; j += 4) apply(j, i);
  }
  return (0);
}
