#include <bits/stdc++.h>

#define FOR(i,b,e) for (int i = (b); i <= (e); i++)
#define FORD(i,b,e) for (int i = (b); i >= (e); i--)
#define SIZE(c) ((int) (c).size())

#define pb push_back
#define st first
#define nd second

using namespace std;


typedef long long ll;
typedef pair <int,int> pii;

typedef vector <int> VI;
typedef vector <ll> VL;
typedef vector <bool> VB;
typedef vector <pii> VP;

typedef vector <VI> VVI;
typedef vector <VL> VVL;
typedef vector <VB> VVB;
typedef vector <VP> VVP;

const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000000000000001LL;

VP solve(int n) {
    int p = 1;
    while (2 * p <= n) {
        p *= 2;
    }

    if (n == p) {
        return {};
    }

    if (n > 3) {
        if (n == p + 1) {
            VP ans;

            FOR(i,1,p-2) {
                ans.pb({i, i + 1});
            }

            ans.pb({p-1, n + 1});

            FOR(i,1,p-2) {
                ans.pb({i + n, i + 1 + n});
            }

            ans.pb({1, p});
            ans.pb({1, p + 1});
            ans.pb({p + 1, n + p});
            ans.pb({p, n + p + 1});

            return ans;
        } else if (n == p + 2) {
            VP ans;

            FOR(i,1,p-2) {
                ans.pb({i, i + 1});
            }

            ans.pb({p-1, n + 1});

            FOR(i,1,p-2) {
                ans.pb({i + n, i + 1 + n});
            }

            ans.pb({1, p});
            ans.pb({1, p + 1});
            ans.pb({p + 1, n + p});
            ans.pb({p, n + p + 1});

            ans.pb({2, p + 2});
            ans.pb({p + 1, n + p + 2});

            return ans;
        }
    }

    int m = 3;
    while (m + 4 <= n) {
        m += 4;
    }

    VI need;
    FOR(i,m+1,n) {
        need.pb(i);
    }

    while (true) {
        VI seq(m);
        FOR(i,0,m-1) {
            seq[i] = i + 1;
        }

        random_shuffle(seq.begin(), seq.end());

        VP res;

        if (!need.empty()) {
            map <int,int> prefXor;
            prefXor[0] = 0;

            res.resize(SIZE(need), {-1, -1});

            int pref = 0;
            FOR(i,0,m-1) {
                pref ^= seq[i];

                FOR(j,0,SIZE(need)-1) if (res[j].st == -1) {
                    int want = pref ^ need[j];
                    if (prefXor.count(want)) {
                        res[j] = {prefXor[want], i};
                    }
                }

                prefXor[pref] = i + 1;
            }
        }

        bool ok = true;
        for (auto &e : res) if (e.st == -1) {
            ok = false;
        }

        if (ok) {
            VP ans;

            FOR(i,0,m-2) {
                ans.pb({seq[i], seq[i+1]});
            }

            ans.pb({seq[m-1], seq[0] + n});

            FOR(i,0,m-2) {
                ans.pb({seq[i] + n, seq[i+1] + n});
            }

            FOR(j,0,SIZE(need)-1) {
                auto r = res[j];

                ans.pb({seq[r.st], need[j]});
                ans.pb({seq[r.nd], need[j] + n});
            }

            return ans;
        }
    }

    assert(false);
}

int main() {
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;

    auto ans = solve(n);

    if (!ans.empty()) {
        cout << "Yes\n";

        for (auto &e : ans) {
            cout << e.st << ' ' << e.nd << '\n';
        }
    } else {
        cout << "No\n";
    }

    return 0;
}

Measured memory_bytes: 4512