Language: C++

#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define M 1000000007
#define ll long long
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define REPI(i,a,b) for(ll i=b-1;i>=a;i--)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define G(a,b) get<a>(b)
#define VI vector<int>
#define VLL vector<long long>

#define o_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define o_setll tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

ll modI(ll a, ll m);
ll gcd(ll a, ll b);
ll powM(ll x, unsigned ll y, unsigned ll m);
void pairsort(int a[], int b[], int n);
void pairsortll(ll a[],ll b[],ll n);
ll logint(ll x,ll y);


ll gcd(ll x,ll y)
{
    if(x==0) return y;
    return gcd(y%x,x);
}

ll powM(ll x,ll y,ll m)
{
    if(y==0) return 1;
    ll p=powM(x,y/2,m)%m;
    p=(p*p)%m;
    return (y%2==0)?p:(x*p)%m;
}

ll modI(ll a, ll m)
{
    ll m0=m,y=0,x=1;
    if(m==1) return 0;
    while(a>1)
    {
        ll q=a/m;
        ll t=m;
        m=a%m;
        a=t;
        t=y;
        y=x-q*y;
        x=t;
    }
    if(x<0) x+=m0;
    return x;
}

void pairsort(int a[],int b[],int n)
{
    pair<int,int> v[n];
    REP(i,0,n)
    {
        v[i].F=a[i];
        v[i].S=b[i];
    }
    sort(v,v+n);
    REP(i,0,n)
    {
        a[i]=v[i].F;
        b[i]=v[i].S;
    }
}

void pairsortll(ll a[],ll b[],ll n)
{
    pair<ll,ll> v[n];
    REP(i,0,n)
    {
        v[i].F=a[i];
        v[i].S=b[i];
    }
    sort(v,v+n);
    REP(i,0,n)
    {
        a[i]=v[i].F;
        b[i]=v[i].S;
    }
}

ll logint(ll x,ll y)
{
    ll ans=0;
    ll a=1;
    for(ll i=0;i<=x;i++)
    {
        if(x<a)
        {
            return ans;
        }
        ans++;
        a*=y;
    }
    return -1;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    /*
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    */

    ll q=1;
    //cin>>q;
    while(q--)
    {
        set<ll> st;
        ll t=1;
        while(t<=1000000000)
        {
            st.insert(t);
            t*=2;
        }
        ll n;
        cin>>n;
        if(st.count(n)==1)
        {
            cout<<"No\n";
        }
        else if(n%2)
        {
            cout<<"Yes\n";
            REP(i,2,n+1)
            {
                cout<<1<<' '<<i<<'\n';
                if(i%2==0)
                {
                    cout<<(i+1)<<' '<<n+i<<'\n';
                }
                else
                {
                    cout<<(i-1)<<' '<<n+i<<'\n';
                }
            }
            cout<<n+1<<' '<<2*n<<'\n';
        }
        else
        {
            cout<<"Yes\n";
            REP(i,2,n)
            {
                cout<<1<<' '<<i<<'\n';
                if(i%2==0)
                {
                    cout<<(i+1)<<' '<<n+i<<'\n';
                }
                else
                {
                    cout<<(i-1)<<' '<<n+i<<'\n';
                }
            }
            cout<<n+1<<' '<<2*n-1<<'\n';
            cout<<n<<' '<<n-1<<'\n';
            x=(n^(n-1)^1);
            cout<<2*n<<' '<<x<<'\n';

        }
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:175:13: error: 'x' was not declared in this scope
  175 |             x=(n^(n-1)^1);
      |             ^