#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int in() {
  int x;
  cin >> x;
  return x;
}
long long lin() {
  long long x;
  cin >> x;
  return x;
}
string stin() {
  string s;
  cin >> s;
  return s;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline void print(pair<T, T> p) {
  cout << "(" << p.first << "," << p.second << ") ";
}
template <class T>
inline void print(vector<pair<T, T>> v) {
  for (auto e : v) print(e);
  cout << "\n";
}
template <class T>
inline void print(T v) {
  for (auto e : v) cout << e << " ";
  cout << "\n";
}
vector<int> a;
void sw(int x, int y) {
  swap(a[x], a[y]);
  cout << x + 1 << " " << y + 1 << "\n";
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);
  int n = in();
  if ((n % 4) > 1)
    cout << "NO\n";
  else {
    cout << "YES\n";
    if (n == 1) return 0;
    for (long long i = 0; i < n; i++) a.push_back(i);
    int pre = -1;
    for (long long i = 0; i < n - 4; i++) {
      if (pre == -1) {
        if (a[i] == i) {
          sw(i, n - 1);
          for (long long j = n - 2; j >= i + 2; j--) sw(i, j);
          sw(i + 1, n - 1);
          sw(i, i + 1);
          pre = n - 1;
        } else {
          for (long long j = n - 1; j >= i + 1; j--)
            if (a[j] != i) sw(i, j);
          for (long long j = i + 1; j <= n - 1; ++j)
            if (a[j] == i) sw(i, j);
        }
      } else {
        if (a[pre] == i) {
          if (i + 1 != pre)
            sw(i + 1, pre);
          else
            pre = -1;
          for (long long j = n - 1; j >= i + 1; j--)
            if (j != pre) sw(i, j);
        } else if (a[i] == i) {
          for (long long j = n - 1; j >= i + 2; j--)
            if (j != pre) sw(i, j);
          sw(i + 1, (pre == n - 1 ? n - 2 : n - 1));
          sw(i, i + 1);
          pre = (pre == n - 1 ? n - 2 : n - 1);
        } else {
          for (long long j = n - 1; j >= i + 1; j--)
            if (a[j] != i and j != pre) sw(i, j);
          for (long long j = i + 1; j <= n - 1; ++j)
            if (a[j] == i) sw(i, j);
          pre = -1;
        }
      }
    }
    vector<pair<int, int>> v;
    for (long long i = n - 4; i <= n - 2; ++i) {
      for (long long j = i + 1; j <= n - 1; ++j) {
        if (i == n - 4 and j == pre) continue;
        v.emplace_back(i, j);
      }
    }
    sort(begin(v), end(v));
    vector<int> ans;
    for (long long i = 0; i < n; i++) ans.push_back(i);
    do {
      auto b = a;
      for (auto e : v) {
        swap(b[e.first], b[e.second]);
      }
      if (ans == b) {
        for (auto e : v) sw(e.first, e.second);
        break;
      }
    } while (next_permutation(begin(v), end(v)));
  }
}
