Problem: Can the greatest common divisor and bitwise operations have anything in common? It is time to answer this question.
Suppose you are given a positive integer . You want to choose some integer from to inclusive in such a way that the greatest common divisor (GCD) of integers and is as large as possible. In other words, you'd like to compute the following function:
Here denotes the bitwise XOR operation, and denotes the bitwise AND operation.
The greatest common divisor of two integers and is the largest integer such that both and are divided by without remainder.
You are given integers . For each of these integers compute the largest possible value of the greatest common divisor (when is chosen optimally).
Input Format: The first line contains an integer () — the number of integers you need to compute the answer for.
After that integers are given, one per line: () — the integers you need to compute the answer for.
Output Format: For each integer, print the answer in the same order as the integers are given in input.
Note: For the first integer the optimal choice is , then , , and the greatest common divisor of and is .
For the second integer one optimal choice is , then , , and the greatest common divisor of and is .
For the third integer the optimal choice is , then , , and the greatest common divisor of and is .