#include <bits/stdc++.h>
const long double PI = acos(-1);
const long double eps = 0.0000000001;
const long long INF = 0x3fffffffffffffff;
long long n, v[1005], lim;
bool did[1005][1005];
long long dfn[1005][1005];
void work(long long a, long long b) {
  did[a][b] = did[b][a] = true;
  dfn[a][b] = dfn[b][a] = -1;
  std::cout << a << ' ' << b << std::endl;
}
void work4(long long a, long long b, long long c, long long d) {
  work(a, b);
  work(a, c);
  work(b, d);
  work(a, d);
  work(b, c);
  work(c, d);
}
void work5(long long a, long long b, long long c, long long d, long long e) {
  work(a, b);
  work(a, c);
  work(a, d);
  work(b, c);
  work(b, e);
  work(c, e);
  work(a, e);
  work(c, d);
  work(b, d);
  work(d, e);
}
void work2_4(long long a, long long b, long long c, long long d, long long e,
             long long f, long long g, long long h) {
  work(a, e);
  work(a, f);
  work(a, g);
  work(b, e);
  work(b, h);
  work(a, h);
  work(b, g);
  work(c, e);
  work(d, f);
  work(c, f);
  work(b, f);
  work(c, g);
  work(d, e);
  work(d, h);
  work(c, h);
  work(d, g);
}
void dfs(long long tim, long long good) {
  for (long long i = 1; i <= n; ++i) {
    if (v[i] != i) {
      bool can = false;
      for (long long j = 1; j < i; ++j) can |= !dfn[j][i];
      for (long long j = i + 1; j <= n; ++j) can |= !dfn[i][j];
      if (!can) return;
    }
  }
  if (tim == lim && good == n) {
    for (long long t = 1; t <= tim; ++t)
      for (long long i = 1; i <= n; ++i)
        for (long long j = i + 1; j <= n; ++j)
          if (dfn[i][j] == t) std::cout << i << ' ' << j << std::endl;
    exit(0);
  }
  for (long long i = 1; i <= n; ++i)
    for (long long j = i + 1; j <= n; ++j)
      if (!dfn[i][j]) {
        dfn[i][j] = tim + 1;
        good -= (i == v[i]);
        good -= (j == v[j]);
        std::swap(v[i], v[j]);
        good += (i == v[i]);
        good += (j == v[j]);
        dfs(tim + 1, good);
        good -= (i == v[i]);
        good -= (j == v[j]);
        std::swap(v[i], v[j]);
        good += (i == v[i]);
        good += (j == v[j]);
        dfn[i][j] = 0;
      }
}
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin >> n;
  for (long long i = 1; i <= n; ++i) v[i] = i;
  switch (n % 4) {
    case 0:
      std::cout << "YES" << std::endl;
      for (long long i = 4; i <= n; i += 4) work4(i - 3, i - 2, i - 1, i);
      for (long long i = 4; i <= n; i += 4)
        for (long long j = i + 4; j <= n; j += 4)
          work2_4(i - 3, i - 2, i - 1, i, j - 3, j - 2, j - 1, j);
      break;
    case 1:
      std::cout << "YES" << std::endl;
      for (long long i = 4; i <= n; i += 4) work5(i - 3, i - 2, i - 1, i, n);
      for (long long i = 4; i <= n; i += 4)
        for (long long j = i + 4; j <= n; j += 4)
          work2_4(i - 3, i - 2, i - 1, i, j - 3, j - 2, j - 1, j);
      break;
    case 2:
    case 3:
      std::cout << "NO" << std::endl;
      break;
  }
  return 0;
}
