Problem:
Score : 700 points

Problem Statement

You are given an integer N. Determine if there exists a tree with 2N vertices numbered 1 to 2N satisfying the following condition, and show one such tree if the answer is yes.

Assume that, for each integer i between 1 and N (inclusive), Vertex i and N+i have the weight i. Then, for each integer i between 1 and N, the bitwise XOR of the weights of the vertices on the path between Vertex i and N+i (including themselves) is i.

Constraints

N is an integer.

1 \leq N \leq 10^{5}

Input

Input is given from Standard Input in the following format:

N

Output

If there exists a tree satisfying the condition in the statement, print Yes; otherwise, print No.
Then, if such a tree exists, print the 2N-1 edges of such a tree in the subsequent 2N-1 lines, in the following format:

a_{1} b_{1}
\vdots
a_{2N-1} b_{2N-1}

Here each pair (a_i, b_i) means that there is an edge connecting Vertex a_i and b_i. The edges may be printed in any order.

Sample Input 1

3

Sample Output 1

Yes
1 2
2 3
3 4
4 5
5 6

The sample output represents the following graph:

Sample Input 2

1

Sample Output 2

No

There is no tree satisfying the condition.

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

//be name khoda
#include<bits/stdc++.h>

#define int long long
#define F first
#define S second

typedef long long ll;
using namespace std;

const int maxn = 2e5+10;
const int mod = 1e9+7;
const ll inf = 2e18;

int N, m;
vector<pair<int,int>> edge;

void build(int n)
{
   // cout<< n <<" "<< m <<"\n";
    if(n&1)
    {
        if(n > 3)
            build(n-2);
    }
    else
    {
        /// m = 2^t;
        if(n == m+2)
        {
          //  cout<< n <<" "<< m <<"\n";
            edge.push_back({m,m+1});
            edge.push_back({m,1});
            edge.push_back({m,2});
            edge.push_back({m,m+2});

            edge.push_back({N+2,m+2});
            edge.push_back({N+m+2,2});
            edge.push_back({N+m+1,1});
            edge.push_back({N+1,m+1});

            edge.push_back({N+m,N+m+1});

            edge.push_back({3,1});
            edge.push_back({N+3,m+2});

            for(int i = 4; i < m; i += 2)
            {
                edge.push_back({i,1});
                edge.push_back({i-1,1});
                edge.push_back({N+i,i-1});
                edge.push_back({N+i-1,i});
            }

            return;
        }
        else
        {
        //   cout<< n <<" ";
            build(n-2);
        }
    }

//    cout<< edge.size() <<"\n";

    int x = (n ^ (n-1));
    edge.push_back({x,n-1});
    edge.push_back({x,n});
    edge.push_back({n, n-1+N});
    edge.push_back({N+n, n-1});
    if(n == 3)
        edge.push_back({N+1,N+3});
}

signed main()
{
  //  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    cin>> N;
    m = 1;
    while(m <= N) m *= 2;
    m /= 2;
    if(m == N) return cout<<"No", 0;

    build(N);
   // cout<< edge.size() <<" ";
    cout<<"Yes\n";
    for(auto e : edge)
        cout<< e.F <<" "<< e.S <<"\n";
}