#P1348D. Phoenix and Science

    ID: 5339 Type: RemoteJudge 2000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>binary searchconstructive algorithmsgreedyimplementationmath*1900

Phoenix and Science

No submission language available for this problem.

Description

Phoenix has decided to become a scientist! He is currently investigating the growth of bacteria.

Initially, on day 11, there is one bacterium with mass 11.

Every day, some number of bacteria will split (possibly zero or all). When a bacterium of mass mm splits, it becomes two bacteria of mass m2\frac{m}{2} each. For example, a bacterium of mass 33 can split into two bacteria of mass 1.51.5.

Also, every night, the mass of every bacteria will increase by one.

Phoenix is wondering if it is possible for the total mass of all the bacteria to be exactly nn. If it is possible, he is interested in the way to obtain that mass using the minimum possible number of nights. Help him become the best scientist!

The input consists of multiple test cases. The first line contains an integer tt (1t10001 \le t \le 1000) — the number of test cases.

The first line of each test case contains an integer nn (2n1092 \le n \le 10^9) — the sum of bacteria masses that Phoenix is interested in.

For each test case, if there is no way for the bacteria to exactly achieve total mass nn, print -1. Otherwise, print two lines.

The first line should contain an integer dd  — the minimum number of nights needed.

The next line should contain dd integers, with the ii-th integer representing the number of bacteria that should split on the ii-th day.

If there are multiple solutions, print any.

Input

The input consists of multiple test cases. The first line contains an integer tt (1t10001 \le t \le 1000) — the number of test cases.

The first line of each test case contains an integer nn (2n1092 \le n \le 10^9) — the sum of bacteria masses that Phoenix is interested in.

Output

For each test case, if there is no way for the bacteria to exactly achieve total mass nn, print -1. Otherwise, print two lines.

The first line should contain an integer dd  — the minimum number of nights needed.

The next line should contain dd integers, with the ii-th integer representing the number of bacteria that should split on the ii-th day.

If there are multiple solutions, print any.

Samples

Sample Input 1

3
9
11
2

Sample Output 1

3
1 0 2 
3
1 1 2
1
0

Note

In the first test case, the following process results in bacteria with total mass 99:

  • Day 11: The bacterium with mass 11 splits. There are now two bacteria with mass 0.50.5 each.
  • Night 11: All bacteria's mass increases by one. There are now two bacteria with mass 1.51.5.
  • Day 22: None split.
  • Night 22: There are now two bacteria with mass 2.52.5.
  • Day 33: Both bacteria split. There are now four bacteria with mass 1.251.25.
  • Night 33: There are now four bacteria with mass 2.252.25.
The total mass is 2.25+2.25+2.25+2.25=92.25+2.25+2.25+2.25=9. It can be proved that 33 is the minimum number of nights needed. There are also other ways to obtain total mass 9 in 3 nights.

In the second test case, the following process results in bacteria with total mass 1111:

  • Day 11: The bacterium with mass 11 splits. There are now two bacteria with mass 0.50.5.
  • Night 11: There are now two bacteria with mass 1.51.5.
  • Day 22: One bacterium splits. There are now three bacteria with masses 0.750.75, 0.750.75, and 1.51.5.
  • Night 22: There are now three bacteria with masses 1.751.75, 1.751.75, and 2.52.5.
  • Day 33: The bacteria with mass 1.751.75 and the bacteria with mass 2.52.5 split. There are now five bacteria with masses 0.8750.875, 0.8750.875, 1.251.25, 1.251.25, and 1.751.75.
  • Night 33: There are now five bacteria with masses 1.8751.875, 1.8751.875, 2.252.25, 2.252.25, and 2.752.75.
The total mass is 1.875+1.875+2.25+2.25+2.75=111.875+1.875+2.25+2.25+2.75=11. It can be proved that 33 is the minimum number of nights needed. There are also other ways to obtain total mass 11 in 3 nights.

In the third test case, the bacterium does not split on day 11, and then grows to mass 22 during night 11.