Time limit: 0.3s
Memory limit: 256MB
Input:
Output:
A long time ago in 2018, the National Olympiad in Informatics was held in the city of Constanta. Every contestant was deeply upset that none of the tasks in the problem set was named Xorstanta.
You are given a number . You also have two variables and and for each number from to you have to choose between and . Output the largest value for possible given the number .
represents the bitwise XOR operation.
Input
The first line contains the number of tests you have to solve, ().
For each test you have a line containing the number ().
For tests worth of the points, and .
For tests worth extra of the points, and .
Output
Each line contains the solution to the test you are solving.
Example
stdin
4
6
30
15
18
stdout
7
31
30
43