CF1343A.Candies

传统题 时间 2000 ms 内存 256 MiB 4 尝试 1 已通过 1 标签

Candies

Recently Vova found nn candy wrappers. He remembers that he bought xx candies during the first day, 2x2x candies during the second day, 4x4x candies during the third day, \dots, 2k1x2^{k-1} x candies during the kk-th day. But there is an issue: Vova remembers neither xx nor kk but he is sure that xx and kk are positive integers and k>1k \gt 1.

Vova will be satisfied if you tell him any positive integer xx so there is an integer k>1k \gt 1 that x+2x+4x++2k1x=nx + 2x + 4x + \dots + 2^{k-1} x = n. It is guaranteed that at least one solution exists. Note that k>1k \gt 1.

You have to answer tt independent test cases.

Input

The first line of the input contains one integer tt (1t1041 \le t \le 10^4) — the number of test cases. Then tt test cases follow.

The only line of the test case contains one integer nn (3n1093 \le n \le 10^9) — the number of candy wrappers Vova found. It is guaranteed that there is some positive integer xx and integer k>1k \gt 1 that x+2x+4x++2k1x=nx + 2x + 4x + \dots + 2^{k-1} x = n.

Output

Print one integer — any positive integer value of xx so there is an integer k>1k \gt 1 that x+2x+4x++2k1x=nx + 2x + 4x + \dots + 2^{k-1} x = n.

Note

In the first test case of the example, one of the possible answers is x=1,k=2x=1, k=2. Then 11+211 \cdot 1 + 2 \cdot 1 equals n=3n=3.

In the second test case of the example, one of the possible answers is x=2,k=2x=2, k=2. Then 12+221 \cdot 2 + 2 \cdot 2 equals n=6n=6.

In the third test case of the example, one of the possible answers is x=1,k=3x=1, k=3. Then 11+21+411 \cdot 1 + 2 \cdot 1 + 4 \cdot 1 equals n=7n=7.

In the fourth test case of the example, one of the possible answers is x=7,k=2x=7, k=2. Then 17+271 \cdot 7 + 2 \cdot 7 equals n=21n=21.

In the fifth test case of the example, one of the possible answers is x=4,k=3x=4, k=3. Then 14+24+441 \cdot 4 + 2 \cdot 4 + 4 \cdot 4 equals n=28n=28.

Samples

7
3
6
7
21
28
999999999
999999984
1
2
1
7
4
333333333
333333328

在线编程 IDE

建议全屏模式获得最佳体验