## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

# [Solution] The XOR-OR Dilemma CodeChef Solution

Chef has an array $A$ of length $N$ such that ${A}_{i}=i$.

In one operation, Chef can pick any two elements of the array, delete them from $A$, and append either their bitwise XOR or their bitwise OR to $A$.

Note that after each operation, the length of the array decreases by $1$.

Let $F$ be the final number obtained after $N-1$ operations are made. You are given an integer $X$, determine if you can get $F=X$ via some sequence of operations.

In case it is possible to get $F=X$, print the operations too (see the section Output format for more

Solution Click Below:-  👉
👇👇👇👇👇

details), otherwise print $-1$.

### Input Format

• The first line of input will contain a single integer $T$, denoting the number of test cases.

• Each test case consists of a single line containing two space-separated integers $N$ and $X$.

### Output Format

For each test case, output $-1$ if it is impossible to get $X$ in the end. Otherwise print $N-1$ lines denoting the operations.

On each line, print

•  if you want replace $x$ and $y$ with .
•  if you want replace $x$ and $y$ with .

Note that $x$ and $y$ are the elements of the array at the time of applying the operation, and if either of them is not present in the array you will receive a WA verdict.

### Constraints

• $1\le T\le 5000$
• $2\le N\le {2}^{15}$
• $1\le X\le {2}^{16}-1$
• The sum of $N$ over all test cases won't exceed