#include <bits/stdc++.h>
using namespace std;
struct rec {
  int x, y;
};
int i, j, m, n, a[1005], cnt;
bool moved[1005][1005];
rec ans[1000005];
void swap(int x, int y) {
  cnt++;
  ans[cnt].x = x;
  ans[cnt].y = y;
  int tmp = a[x];
  a[x] = a[y];
  a[y] = tmp;
  moved[x][y] = moved[y][x] = true;
}
int main() {
  memset(moved, false, sizeof(moved));
  scanf("%d", &n);
  if (n == 1) {
    printf("YES\n");
    return 0;
  }
  if (n == 2) {
    printf("NO\n");
    return 0;
  }
  for (i = 1; i <= n; i++) a[i] = i;
  swap(1, 2);
  swap(2, 3);
  for (i = 1; i <= n; i++) {
    for (j = i + 1; j <= n; j++) {
      if ((a[j] != i) && (!moved[i][j])) {
        swap(i, j);
      }
    }
    for (j = i + 1; j <= n; j++) {
      if ((a[j] == i) && (!moved[i][j])) swap(i, j);
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = i + 1; j <= n; j++) {
      if (!moved[i][j]) {
        printf("NO\n");
        return 0;
      }
    }
  }
  for (i = 1; i <= n; i++) {
    if (a[i] != i) {
      printf("NO\n");
      return 0;
    }
  }
  printf("YES\n");
  for (i = 1; i <= cnt; i++) {
    printf("%d %d\n", ans[i].x, ans[i].y);
  }
  return 0;
}
