#include<bits/stdc++.h>

using namespace std;

int N, fst[100009], snd[100009];

const bool DBG = 0;
namespace checker {
    vector < int > v[1009];
    int xo[1009], weight[1009], N;
    void dfs (int nod, int tata)
    {
        for (auto it : v[nod])
            if (it != tata)
                xo[it] = xo[nod] ^ weight[it], dfs (it, nod);
    }

    void check ()
    {
        fclose (stdin);
        fclose (stdout);
        ifstream f ("input");
        f >> N;
        f.close ();
        ifstream g ("output");
        string str;
        g >> str;
        for (int i=1; i<2 * N; i++)
        {
            int x, y;
            assert (g >> x >> y);
            v[x].push_back (y);
            v[y].push_back (x);
        }
        g.close ();
        for (int i=1; i<=2 * N; i++)
            weight[i] = (i <= N ? i : i - N);
        for (int i=1; i<=N; i++)
        {
            xo[i] = weight[i], dfs (i, -1);
            if (xo[N + i] != i)
            {
                fprintf (stderr, "WA %d (%d instead)\n", i, xo[N + i]);
                exit (0);
            }
            assert (xo[N + i] == i);
        }
        fprintf (stderr, "OK\n");
        exit (0);
    }
}

int main ()
{
//checker::check ();
if (DBG)
    freopen ("input", "r", stdin),
    freopen ("output", "w", stdout);

scanf ("%d", &N);
int K = 0;
while ((2 << K) - 1 <= N)
    K ++;
if (N == 1 || N == (1 << K)) printf ("No\n");
else
{
    for (int i=1; i<=N; i++)
        fst[i] = i, snd[i] = i + N;
    printf ("Yes\n");
    int M = (1 << K) - 1;
    for (int i=1; i<M; i++)
        printf ("%d %d\n", fst[i], fst[i + 1]),
        printf ("%d %d\n", snd[i], snd[i + 1]);
    printf ("%d %d\n", fst[M], snd[1]);
    if ((N - M) % 2 == 0)
    {
        int xo = 0;
        for (int i=M + 1; i<=N; i++)
            xo ^= i;
        int need = xo, entrance, escape;
        ///even number of those
        if (need == 0) entrance = 1, escape = M;
        else entrance = fst[need], escape = fst[need];
        for (int i=M + 1; i<N; i++)
            printf ("%d %d\n", fst[i], fst[i + 1]),
            printf ("%d %d\n", snd[i], snd[i + 1]);
        if (M < N)
            printf ("%d %d\n", fst[N], entrance),
            printf ("%d %d\n", escape, snd[M + 1]);
    }
    else
    {
        ///odd number of those, at least 2^K, 2^K+1, 2^K+2
        if (N == M + 3)
        {
            int zr = M + 1, u = M + 2, d = M + 3;
            printf ("%d %d\n", fst[zr], fst[u]);
            printf ("%d %d\n", fst[u], fst[d]);
            printf ("%d %d\n", fst[u], fst[1]);

            printf ("%d %d\n", fst[2], snd[d]);
            printf ("%d %d\n", fst[1], snd[zr]);
            printf ("%d %d\n", snd[zr], snd[u]);
        }
        else
        {
            ///at least 4 nodes
            int xo = 0;
            for (int i=M + 2; i<=N; i++)
                xo ^= i;
            int need = xo, entrance, escape;
            if (need == 0) entrance = 1, escape = M;
            else entrance = fst[need], escape = fst[need];
            for (int i=M + 2; i<N; i++)
                printf ("%d %d\n", fst[i], fst[i + 1]),
                printf ("%d %d\n", snd[i], snd[i + 1]);
            printf ("%d %d\n", fst[N], entrance);
            printf ("%d %d\n", escape, snd[M + 2]);

            printf ("%d %d\n", snd[M + 4], snd[M + 1]);
            if (escape > N) printf ("%d %d\n", fst[M + 1], escape - N + 1);
            else printf ("%d %d\n", fst[M + 1], escape + N - 1);
        }
    }
}
if (DBG)
    checker::check ();
return 0;
}


Measured memory_bytes: 3584