atcoder#AGC035C. [AGC035C] Skolem XOR Tree

[AGC035C] Skolem XOR Tree

Score : 700700 points

Problem Statement

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

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

Constraints

  • NN is an integer.
  • 1N1051 \leq N \leq 10^{5}

Input

Input is given from Standard Input in the following format:

NN

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 2N12N-1 edges of such a tree in the subsequent 2N12N-1 lines, in the following format:

a1a_{1} b1b_{1}

\vdots

a2N1a_{2N-1} b2N1b_{2N-1}

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

3
Yes
1 2
2 3
3 4
4 5
5 6
  • The sample output represents the following graph:
1
No
  • There is no tree satisfying the condition.