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)

#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin>>N;
  if(__builtin_popcount(N)==1){cout<<"No"<<endl; return 0;}
  ll mi=1,mx=1;
  while(mx*2<=N+1){mx<<=1;}
  while(!(N&mi)){mi<<=1;}
  vector<pll> ans;
  for(ll i=1;i+1<mx;i++){
    ans.push_back({i,i+1});
    ans.push_back({N+i,N+i+1});
  }
  ans.push_back({mx-1,N+1});
  for(int i=mx;i<N;i+=2){
    ans.push_back({i,i+1});
    ans.push_back({i+1,1});
    ans.push_back({1,N+i});
    ans.push_back({N+i,N+i+1});
  }
  if(!(N&1)){
    ll k=N^mi;
    ans.push_back({N,N+k});
    ans.push_back({mi,N+N});
  }
  assert((int)ans.size()==2*N-1);
  cout<<"Yes"<<endl;
  for(auto &I:ans){cout<<I.F<<" "<<I.S<<endl;}
  
  
  return 0;
}