## GUPTA MECHANICAL

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

## [Solution] Equal by XORing CodeChef Solution | CodeChef Problem Solution 2022

JJ has three integers $A$$B$, and $N$. He can apply the following operation on $A$:

• Select an integer $X$ such that $1\le X and set $A:=A\oplus X$. (Here, $\oplus$ denotes the bitwise XOR operation.)

JJ wants to make $A$ equal to $B$.
Determine the minimum number of operations required to do so. Print $-1$ if it is not possible.

### Input Format

• The first line contains a single integer $T$ — the number of test cases. Then the test cases follow.

• The first and only line of each test case contains three integers $A$$B$, and $N$ — the parameters mentioned in the statement.

### Output Format

For each test case, output the minimum number of operations required to make $A$ equal to $B$.

Output $-1$ if it is not possible to do so.

### Constraints

• $1\le T\le 1000$
• $0\le A,B<{2}^{30}$