#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
inline long long read() {
  register long long x = 0, f = 1;
  register char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
  return x * f;
}
void write(long long x) {
  if (x < 0) x = -x, putchar('-');
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
void writeln(long long x) {
  write(x);
  puts("");
}
const int mod = 998244353;
void print(int x, int y) { printf("%d %d\n", x, y); }
int main() {
  int n = read();
  if (n % 4 == 0 || n % 4 == 1) {
    puts("YES");
  } else {
    puts("NO");
    return 0;
  }
  for (int i = 1; i < n; i += 4) {
    if (n % 4 == 1) {
      print(i, n), print(i, i + 1), print(i + 1, n);
      print(i + 2, n), print(i + 2, i + 3), print(i + 3, n);
    } else
      print(i, i + 1), print(i + 2, i + 3);
    print(i, i + 2), print(i + 1, i + 3);
    print(i, i + 3);
    print(i + 1, i + 2);
  }
  for (int i = 1; i < n; i += 4) {
    for (int j = i + 4; j < n; j += 4) {
      print(i, j), print(i + 1, j + 1), print(i + 2, j + 2),
          print(i + 3, j + 3);
      print(i, j + 1), print(i + 1, j), print(i + 2, j + 3),
          print(i + 3, j + 2);
      print(i, j + 2), print(i + 2, j), print(i + 1, j + 3),
          print(i + 3, j + 1);
      print(i, j + 3), print(i + 3, j), print(i + 1, j + 2),
          print(i + 2, j + 1);
    }
  }
  return 0;
}
