#P11785. 「FAOI-R4」手写的从前

    ID: 11181 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 5 上传者: 标签>数学2025洛谷原创O2优化构造洛谷月赛

「FAOI-R4」手写的从前

Description

Little ζ\zeta loves non-negative integer powers of 22.

He asks you to construct an integer sequence that satisfies the following conditions:

  • Its length is a non-negative integer power of 22.
  • Its elements are all non-negative integer powers of 22.
  • The sum of its elements is mm.

That's still too easy. Therefore, you are asked to minimize the length of the sequence, and based on this, minimize the lexicographic order of the sequence.

It can be proven that a proper solution always exists under the given constraints.

Input Format

The first line of input contains a single integer TT, denoting the number of test cases. The description of test cases follows.

The first and only line of each test case contains a single integer mm.

Output Format

For each test case, output a single line containing a series of numbers, separated by space, as your constructed sequence. It is guaranteed the sum of the lengths of the answer sequences of each test case does not exceed 2×1062\times10^6.

2
5
6
1 4
2 4

Hint

Sample Explanation

1,2,41, 2, 4 are all non-negative integer powers of 22.

The sequence [1,4][1, 4] contains all non-negative integer powers of 22, has a sum of 1+4=5=m1 + 4 = 5 = m, and has a length of 22, also a non-negative integer power of 22.

It can be proven that there is no sequence of strict shorter length nor smaller lexicographic order, hence the answer is sequence [1,4][1, 4]. So is the case for m=6m = 6.

Constraints

Testdata ID T T \le m m \le
1 1
2 2 10 10 10 10
36 3 \sim 6 105 10^5
78 7 \sim 8 104 10^4 109 10^9
910 9 \sim 10 1018 10^{18}

For all tests, it's guaranteed that 1T1041 \leq T \leq 10^4, 1m10181 \leq m \leq 10^{18} and the sum of the lengths of the answer sequences of each test case does not exceed 2×1062\times10^6. Each test is worth 1010 points.