#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int n, m;
const int maxN = (int)1e5 + 100;
vector < int > g[maxN];
int edges = 0;
vector < pair < int, int > > ans;
bool used[maxN];
int total[maxN];
void dfs(int v, int par) {
    used[v] = true;
    for (int to : g[v]) {
        if (used[to] && to != par) {
            ans.emplace_back(v, to);
            total[v] ^= 1;
        }
    }
    for (int to : g[v]) {
        if (!used[to]) dfs(to, v);
    }
    if (v != 1) {
        if (total[v] == 1) {
            ans.emplace_back(v, par);
            total[v] = 0;
        } else {
            ans.emplace_back(par, v);
            total[par] ^= 1;
        }
    }
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    if ((n & (n - 1)) == 0) {
        cout << "No";
        return 0;
    }
    cout << "Yes" << '\n';
    int pr = 0;
    for (int i = 1; i <= n; i++) {
        pr ^= i;
    }
    int gr = 1;
    while (2 * gr <= n) gr *= 2;
    if (pr == 0) {
        for (int i = 1; i + 1 <= 2 * n; i++) {
            cout << i << " " << i + 1 << '\n';
        }
        return 0;
    }
    if (pr <= n) {
        int a = -1;
        int b = -1;
        for (int i = 1; i <= n; i++) {
            int x = i;
            int y = pr ^ i;
            if (x > n || y > n || x == y || x == pr || y == pr || x == 0 || y == 0) continue;
            a = x;
            b = y;
        }
        assert(a > 0);
        vector < int > ord;
        ord.push_back(a);
        ord.push_back(b);
        for (int i = 1; i <= n; i++) {
            if (i == pr || i == a || i ==  b) continue;
            ord.push_back(i);
        }
        int t = ord.size();
        for (int i = 0; i < t; i++) {
            ord.push_back(ord[i] + n);
        }
        for (int i = 0; i + 1 < 2 * t; i++) {
            cout << ord[i] << " " << ord[i + 1] << '\n';
        }
        cout << ord[0] << " " << pr << '\n' << ord[1] << " " << pr + n << '\n';
        return 0;
    }
    int a = gr;
    int b = pr - gr;
    for (int i = 1; i <= n; i++) {
        vector < int > v = {a ^ i, i, b ^ i};
        bool ok = true;
        for (int j = 0; j < v.size(); j++) {
            if (v[j] == a || v[j] == b) ok = false;
            for (int k = 0; k < j; k++) if (v[j] == v[k]) ok = false;
        }
        if (!ok) continue;
        vector < int > ord;
        ord.push_back(v[0]);
        ord.push_back(v[1]);
        ord.push_back(v[2]);
        for (int j = 1; j <= n; j++) {
            if (j == a || j == b || j == v[0] || j == v[1] || j == v[2]) continue;
            ord.push_back(j);
        }
        int t = ord.size();
        for (int ii = 0; ii < t; ii++) {
            ord.push_back(ord[ii] + n);
        }
        for (int ii = 0; ii + 1 < 2 * t; ii++) {
            cout << ord[ii] << " " << ord[ii + 1] << '\n';
        }
        cout << a << " " << ord[0] << '\n' << a + n << " " << ord[1] << '\n';
        cout << b << " " << ord[1] << '\n' << b + n << " " << ord[2] << '\n';
        return 0;
    }
    assert(false);
    return 0;
}

Measured memory_bytes: 6004