#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
int perm0[20][2] = {0, 8, 3, 5, 0, 6, 4, 8, 2, 8, 1, 6, 3, 6, 1, 5, 0, 7, 3, 8,
                    4, 5, 4, 7, 1, 7, 2, 6, 3, 7, 0, 5, 1, 8, 2, 5, 2, 7, 4, 6};
int perm1[16][2] = {0, 4, 0, 5, 0, 6, 1, 4, 1, 7, 0, 7, 1, 6, 2, 4,
                    3, 5, 2, 5, 1, 5, 2, 6, 3, 4, 3, 7, 2, 7, 3, 6};
int perm2[6][2] = {1, 3, 0, 3, 1, 2, 0, 1, 2, 3, 0, 2};
int perm3[10][2] = {2, 4, 0, 2, 3, 4, 1, 3, 1, 4, 0, 4, 0, 1, 2, 3, 1, 2, 0, 3};
int n, v[30];
int main() {
  scanf("%d", &n);
  if (n % 4 == 2 || n % 4 == 3) {
    puts("NO");
    return 0;
  }
  if (n == 1) {
    puts("YES");
    return 0;
  }
  puts("YES");
  for (int i = 0; i < n / 4; i++)
    for (int j = i + 1; j < n / 4; j++) {
      if (n % 4 == 0) {
        for (int k = 0; k < 4; k++) v[k] = i * 4 + 1 + k;
        for (int k = 0; k < 4; k++) v[k + 4] = j * 4 + 1 + k;
        for (int j = 0; j < 16; j++)
          printf("%d %d\n", v[perm1[j][0]], v[perm1[j][1]]);
      } else if (i == 0) {
        for (int k = 0; k < 5; k++) v[k] = i * 4 + 1 + k;
        for (int k = 0; k < 4; k++) v[k + 5] = j * 4 + 2 + k;
        for (int j = 0; j < 20; j++)
          printf("%d %d\n", v[perm0[j][0]], v[perm0[j][1]]);
      } else {
        for (int k = 0; k < 4; k++) v[k] = i * 4 + 2 + k;
        for (int k = 0; k < 4; k++) v[k + 4] = j * 4 + 2 + k;
        for (int j = 0; j < 16; j++)
          printf("%d %d\n", v[perm1[j][0]], v[perm1[j][1]]);
      }
    }
  for (int i = 0; i < n / 4; i++) {
    if (n % 4 == 0) {
      for (int k = 0; k < 4; k++) v[k] = i * 4 + 1 + k;
      for (int j = 0; j < 6; j++)
        printf("%d %d\n", v[perm2[j][0]], v[perm2[j][1]]);
    } else if (i == 0) {
      for (int k = 0; k < 5; k++) v[k] = i * 4 + 1 + k;
      for (int j = 0; j < 10; j++)
        printf("%d %d\n", v[perm3[j][0]], v[perm3[j][1]]);
    } else {
      for (int k = 0; k < 4; k++) v[k] = i * 4 + 2 + k;
      for (int j = 0; j < 6; j++)
        printf("%d %d\n", v[perm2[j][0]], v[perm2[j][1]]);
    }
  }
}
