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

Initially, on day $1$, there is one bacterium with mass $1$.

Every day, some number of bacteria will split (possibly zero or all). When a bacterium of mass $m$ splits, it becomes two bacteria of mass $\frac{m}{2}$ each. For example, a bacterium of mass $3$ can split into two bacteria of mass $1.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 $n$. 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!


-----Input-----

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

The first line of each test case contains an integer $n$ ($2 \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 $n$, print -1. Otherwise, print two lines.

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

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

If there are multiple solutions, print any.


-----Example-----
Input
3
9
11
2

Output
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 $9$:   Day $1$: The bacterium with mass $1$ splits. There are now two bacteria with mass $0.5$ each.  Night $1$: All bacteria's mass increases by one. There are now two bacteria with mass $1.5$.  Day $2$: None split.  Night $2$: There are now two bacteria with mass $2.5$.  Day $3$: Both bacteria split. There are now four bacteria with mass $1.25$.  Night $3$: There are now four bacteria with mass $2.25$.  The total mass is $2.25+2.25+2.25+2.25=9$. It can be proved that $3$ 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 $11$:   Day $1$: The bacterium with mass $1$ splits. There are now two bacteria with mass $0.5$.  Night $1$: There are now two bacteria with mass $1.5$.  Day $2$: One bacterium splits. There are now three bacteria with masses $0.75$, $0.75$, and $1.5$.  Night $2$: There are now three bacteria with masses $1.75$, $1.75$, and $2.5$.  Day $3$: The bacteria with mass $1.75$ and the bacteria with mass $2.5$ split. There are now five bacteria with masses $0.875$, $0.875$, $1.25$, $1.25$, and $1.75$.  Night $3$: There are now five bacteria with masses $1.875$, $1.875$, $2.25$, $2.25$, and $2.75$.  The total mass is $1.875+1.875+2.25+2.25+2.75=11$. It can be proved that $3$ 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 $1$, and then grows to mass $2$ during night $1$.

Source: codeforces | Difficulty: HARD
Tags: Constructive algorithms

Sorting

Implementation

Greedy algorithms

Mathematics


Solutions:
import math
t = int(input())

def split(d, x):
	if d <= 3 * x:
		return [0, d - 2 * x]
	else:
		return [x // 2, d - 3 * x]
while t:
	n = int(input())
	x = 1
	while x <= n:
		x = x * 2 + 1
	x = (x - 1) // 2
	d = n - x
	if d == 0:
		ans = []
	elif d >= (x + 1) // 2:
		ans = [d - (x + 1) // 2]
	else:
		d += (x + 1) // 2
		x = (x - 1) // 2
		ans = split(d, (x + 1) // 2)
	k = 1
	tmp = []
	while k < x:
		tmp.append((k + 1) // 2)
		k = k * 2 + 1
	tmp.extend(ans)
	print(len(tmp))
	for x in tmp:
		print(x, end=' ')
	print()
	t -= 1


from math import log2, floor, ceil
import bisect
for _ in range(int(input())):
	n = int(input())
	f = floor(log2(n + 1))
	c = ceil(log2(n + 1))
	arr = []
	acc = 1
	for i in range(f):
		arr.append(acc)
		acc *= 2
	ex = n - (2 ** f - 1)
	if ex != 0:
		bisect.insort(arr, ex)
	res = []
	for i in range(len(arr) - 1):
		res.append(arr[i + 1] - arr[i])
	print(len(res))
	print(*res)


t = int(input())
for tt in range(t):
	n = int(input())
	i = 1
	sums = []
	summ = 0
	while summ <= n:
		sums.append(i)
		summ += i
		i *= 2
	i = round(i / 2)
	sums[len(sums) - 1] -= summ - n
	if sums[-1] == 0:
		sums.remove(0)
	sums.sort()
	print(len(sums) - 1)
	for i in range(len(sums) - 1):
		print(sums[i + 1] - sums[i], end=' ')
	print()


from collections import deque

def solve():
	n = int(input())
	(mass, d) = (0, 1)
	summ = deque()
	while mass < n:
		mass += 2 ** (d - 1)
		summ.append(2 ** (d - 1))
		d += 1
	if mass == n:
		print(d - 2)
		for i in range(d - 2):
			print(summ[i], end=' ')
	elif mass > n:
		diff = mass - n
		j = d - 3
		while diff > summ[j]:
			summ[j + 1] = summ[j]
			diff = diff - summ[j]
			j -= 1
		if diff <= summ[j]:
			maxx = 2 * summ[j]
			minn = summ[j]
			if maxx - diff >= minn:
				summ[j + 1] = maxx - diff
		print(d - 2)
		for i in range(1, d - 1):
			print(summ[i] - summ[i - 1], end=' ')
		print()
t = int(input())
for i in range(t):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	count = 0
	li = []
	while True:
		p = int(pow(2, count))
		if p <= n:
			li.append(p)
			n -= p
			count += 1
		else:
			break
	if n > 0:
		x = li[count - 1]
		if n >= x:
			li.append(n)
		else:
			li[count - 1] = (x + n) // 2
			if (x + n) % 2 != 0:
				li.append((x + n) // 2 + 1)
			else:
				li.append((x + n) // 2)
	print(len(li) - 1)
	for i in range(1, len(li)):
		print(li[i] - li[i - 1], end=' ')
	print()


import math as m
t = int(input())
while t:
	t -= 1
	n = int(input())
	x = int(m.log2(n))
	a = []
	i = 0
	while n > 0:
		a.append(2 ** i)
		n -= a[-1]
		i += 1
	if n < 0:
		n += a[-1]
		a.pop(-1)
	if n > 0:
		a.append(n)
		a.sort()
	print(len(a) - 1)
	for i in range(0, len(a) - 1):
		print(a[i + 1] - a[i], end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	res = 0
	arr = []
	i = 1
	while i <= n:
		arr.append(i)
		n -= i
		i *= 2
	if n > 0:
		arr.append(n)
		arr.sort()
	print(len(arr) - 1)
	for i in range(1, len(arr)):
		print(arr[i] - arr[i - 1], end=' ')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	total = 1
	ans = [1]
	while total < n:
		if total + 2 * ans[-1] <= n:
			total += 2 * ans[-1]
			ans.append(2 * ans[-1])
		elif total + ans[-1] <= n:
			ans.append(n - total)
			total += n - total
		else:
			left = n - (total - ans[-1])
			ans[-1] = left // 2
			assert ans[-1] >= ans[-2]
			ans.append(left // 2 + (left & 1))
			total += left // 2 + left // 2 + (left & 1)
	print(len(ans) - 1)
	print(' '.join(map(str, (b - a for (a, b) in zip(ans, ans[1:])))))


def sol():
	import math
	n = int(input())
	d = int(math.log2(n)) - 1
	res = list(map(lambda x: 2 ** x, range(0, d)))
	c = 1 + n - 2 ** (d + 1)
	if c >= 2 ** d:
		res.append(c - 2 ** d)
		d += 1
	elif c < 2 ** d:
		res[-1] = (c + 2 ** d) // 2 - 2 ** (d - 1)
		res.append(c + 2 ** d - 2 * ((c + 2 ** d) // 2))
		d += 1
	print(d)
	print(*res)
case = int(input())
for i in range(1, case + 1):
	sol()


import sys
import io, os
import math
from heapq import *
gcd = math.gcd
sqrt = math.sqrt
ceil = math.ceil
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def strinp(testcases):
	k = 5
	if testcases == -1 or testcases == 1:
		k = 1
	f = str(input())
	f = f[2:len(f) - k]
	return f

def ind(ch):
	return ord(ch) - ord('a')

def closestpow(n, c=2):
	rem = 0
	k = 0
	while n > 1:
		rem += n % c
		n = n // c
		k += 1
	return k

def rec(n, lis):
	if n == 1:
		return 1
	f = closestpow(n)
	diff = 2 ** (f - 1)
	st = 2 ** f - 1
	if n >= st + diff:
		p = rec(st, lis)
		lis.append(n - (st + diff))
		return p + n - (st + diff)
	else:
		p = rec(n - diff, lis)
		f = n - (n - diff + p)
		lis.append(f)
		return f + p

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = []
		rec(n, a)
		print(len(a))
		print(*a)
main()


input = __import__('sys').stdin.readline
print = __import__('sys').stdout.write

def tmptmp(n):
	k = 2
	idx = 1
	while k < n:
		k = k * 2 + 2
		idx += 1
	return idx
for _ in range(int(input())):
	n = int(input())
	n -= 1
	days = tmptmp(n)
	n -= days
	mok = []
	ppp = [2 ** i for i in range(31)]
	idx = 0
	for i in range(days, 0, -1):
		mok2 = min(n // i, ppp[idx])
		mok.append(mok2)
		n -= mok2 * i
		idx += 1
	print(f'{days}\n')
	print(f"{' '.join(map(str, mok))}\n")


def day_needed(w, cnt):
	if w <= 0:
		return 0
	return 1 + day_needed(w - cnt * 2, cnt * 2)
for testcase in range(int(input())):
	n = int(input()) - 1
	nday = day_needed(n, 1)
	print(nday)
	cnt = 1
	for i in range(nday):
		(l, r) = (0, cnt)
		while l < r:
			mid = (l + r) // 2
			if day_needed(n - mid - cnt, cnt + mid) + i + 1 > nday:
				l = mid + 1
			else:
				r = mid
		print(l, end=' ')
		cnt += l
		n -= cnt
	print()


def split(word):
	return [char for char in word]
t = int(input())
for i in range(t):
	n = int(input())
	nlist = split('{0:b}'.format(n))
	ans = []
	current = n
	for j in range(1, len(nlist)):
		if nlist[j] == '1':
			ans.append(current - pow(2, len(nlist) - j) + 1)
			for k in range(1, len(nlist) - j):
				ans.append(pow(2, len(nlist) - j - k))
			break
		else:
			current -= pow(2, len(nlist) - j - 1)
			if j == len(nlist) - 1:
				ans.append(1)
			else:
				ans.append(pow(2, len(nlist) - j - 1))
	if n == 2:
		print(1)
		print(0)
	else:
		print(len(ans))
		ans.reverse()
		print(ans[0] - 1)
		for j in range(1, len(ans)):
			print(ans[j] - ans[j - 1])


import sys
from collections import deque
input = lambda : sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
	n = int(input())
	k = 1
	w = 1
	ans = []
	while w + 2 * k < n:
		ans.append(k)
		w += 2 * k
		k *= 2
	ans.append(n - k - w)
	if ans[-1] < 0:
		ans.pop()
		ans.pop()
		w -= k
		d = (n - k - w) // 2
		ans.append(d)
		ans.append(n - k - w - 2 * d)
	print(len(ans))
	print(*ans)


for _ in range(int(input())):
	N = int(input())
	inc = []
	i = 1
	while i <= N:
		inc.append(i)
		N -= i
		i *= 2
	if N > 0:
		inc.append(N)
		inc = sorted(inc)
	print(len(inc) - 1)
	for i in range(1, len(inc)):
		print(inc[i] - inc[i - 1], end=' ')
	print()


import sys
from math import ceil
from itertools import islice, cycle
from collections import Counter
stdin = sys.stdin
t = int(stdin.readline())
for line in stdin:
	if not line:
		break
	n = int(line.strip())
	splits = [1]
	masses = [3]
	idx = 2
	while masses[-1] < n:
		idx += 1
		split = splits[-1] * 2
		splits.append(split)
		masses.append(2 ** idx - 1)
	surplus = masses[-1] - n
	if surplus <= splits[-1]:
		splits[-1] -= surplus
		print(len(splits))
		for s in splits:
			print(s, end=' ')
		print()
	else:
		surplus -= splits[-1]
		splits[-1] = surplus % 2
		splits[-2] -= (surplus + 1) // 2
		print(len(splits))
		for s in splits:
			print(s, end=' ')
		print()


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	i = 0
	while 2 ** (i + 1) <= n + 1:
		i += 1
	i -= 1
	lt = [2 ** k for k in range(i + 1)]
	if sum(lt) != n:
		lt.append(n - sum(lt))
		lt.sort()
	print(len(lt) - 1)
	p = [lt[i] - lt[i - 1] for i in range(1, len(lt))]
	print(*p)


from sys import stdin, stdout
global ans, flag

def backtrack(x, y):
	global ans, flag
	if flag:
		return
	if x + y > n:
		return
	if x + y <= n and x + 2 * y >= n:
		ans.append(n - x - y)
		flag = True
		return
	for i in range(x + 2 * y, x + y - 1, -1):
		ans.append(i - x - y)
		backtrack(i, i - x)
		if flag:
			return
		ans.pop()
		flag = True
		return
	return
T = int(stdin.readline().strip())
for caso in range(T):
	n = int(stdin.readline().strip())
	flag = False
	ans = []
	backtrack(1, 1)
	x = 2 ** (len(ans) + 1) - 1
	y = 2 ** len(ans)
	z = (n - x - 2 * y) // 2
	if z >= 0:
		ans.append(z)
		ans.append((n + 1) % 2)
	print(len(ans))
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	arr = []
	for i in range(32):
		if n - 2 ** i >= 0:
			arr.append(2 ** i)
			n -= 2 ** i
		else:
			break
	if n > 0:
		arr.append(n)
	arr.sort()
	print(len(arr) - 1)
	for i in range(1, len(arr)):
		print(arr[i] - arr[i - 1], end=' ')
	print()


from math import log2
T = int(input())
for t in range(T):
	n = int(input())
	lg = int(log2(n))
	base = 2 ** lg - 1
	dif = n - base
	ans = []
	cur = 1
	nodes = 1
	flag = True
	toGet = 1
	while cur < n:
		if nodes <= dif and dif < nodes * 2 and flag:
			ans.append(dif - nodes)
			nodes = dif
			cur += dif
			flag = False
			continue
		toGet *= 2
		ans.append(toGet - nodes)
		nodes = toGet
		cur += nodes
	print(len(ans))
	print(' '.join(list(map(str, ans))))


for t in range(int(input())):
	n = s = int(input())
	l = []
	cur = 1
	while n >= cur:
		n -= cur
		l += [cur]
		cur *= 2
	if n:
		l += [n]
	print(len(l) - 1)
	l.sort()
	st = ''
	for i in range(len(l) - 1):
		st += ' ' + str(l[i + 1] - l[i])
	print(st[1:])


for f in range(int(input())):
	n = int(input())
	d = 0
	bac = 1
	ma = 1
	sol = []
	while ma < n:
		sol.append(bac)
		bac *= 2
		ma += bac
		d += 1
	if ma > bac:
		x = ma - n
		if x <= sol[-1]:
			sol[-1] -= x
		else:
			x -= sol[-1]
			sol[-1] = 0
			if x % 2 != 0:
				sol[-1] = 1
				x += 1
			x //= 2
			sol[-2] -= x
	print(d)
	print(*sol)


def solve(n):
	cur = 1
	n -= 1
	nums = [1]
	while True:
		cur *= 2
		if n >= 2 * cur:
			nums.append(cur)
			n -= cur
		elif n > cur:
			if n == 3:
				(a, b) = (1, 2)
			else:
				a = max(cur // 2, n // 3 + 1)
				b = n - a
			nums.extend([a, b])
			break
		else:
			nums.append(n)
			break
	print(len(nums) - 1)
	print(*[b - a for (a, b) in zip(nums, nums[1:])])
T = int(input())
for t in range(T):
	n = int(input())
	solve(n)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	s = 0
	k = 1
	while s + k <= n:
		s += k
		a.append(k)
		k *= 2
	if s < n:
		a.append(n - s)
		a.sort()
	b = []
	for i in range(1, len(a)):
		b.append(a[i] - a[i - 1])
	print(len(b))
	print(*b)


import math

def solve(n):
	k = int(math.log2(n))
	t = n - (2 ** k - 1)
	l = int(math.log2(t))
	ans = []
	for i in range(k):
		if i == l:
			cur = t - 2 ** i
		elif i == l + 1:
			cur = 2 ** i - t
		elif i < l:
			cur = 2 ** i
		else:
			cur = 2 ** (i - 1)
		ans.append(cur)
	return ans
t = int(input())
for _ in range(t):
	n = int(input())
	ans = solve(n)
	print(len(ans))
	print(*ans, sep=' ')


import sys
input = sys.stdin.readline
inf = 100000000000000000
mod = 998244353
ANS = [0] * 40

def check(x):
	sum = x + 1
	for day in range(x):
		base = x - day
		maxnum = 1 << day
		delta = n - sum
		need = delta // base
		ANS[day] = min(maxnum, need)
		sum += ANS[day] * base
	if sum < n:
		return False
	return True
for CASES in range(int(input())):
	n = int(input())
	l = 0
	r = 35
	ans = r
	while l <= r:
		mid = (l + r) // 2
		if check(mid):
			r = mid - 1
			ans = mid
		else:
			l = mid + 1
	print(ans)
	check(ans)
	for i in range(ans):
		print(ANS[i], end=' ')
	print()


T = int(input())

def check(answer, N):
	count = 1
	mass = 1
	for ans in answer:
		assert ans <= count, f'ans: {ans}, count: {count}'
		assert ans >= 0, ans
		count += ans
		mass += count
	assert mass == N, mass
for t in range(T):
	N = int(input())
	if N < 2:
		print(-1)
		continue
	if N == 2:
		print(1)
		print(0)
		continue
	if N == 3:
		print(1)
		print(1)
		continue
	if N == 4:
		print(2)
		print('0 1')
		continue
	answer = []
	ipower = 0
	mass = 1
	nb_bacteria = 1
	while mass < N:
		nb_split = 2 ** ipower
		ipower += 1
		nb_bacteria += nb_split
		mass += nb_bacteria
		answer.append(nb_split)
	while mass != N:
		i = len(answer) - 1
		ipower = 0
		projected_mass = mass
		while i > 0:
			if projected_mass - 2 ** ipower < N:
				break
			projected_mass -= 2 ** ipower
			ipower += 1
			i -= 1
		mass = projected_mass
		if i + 1 < len(answer):
			answer[i + 1] -= 1
		nb_minus = 1
		for k in range(i + 2, len(answer)):
			answer[k] -= nb_minus
			nb_minus *= 2
	print(len(answer))
	print(' '.join(map(str, answer)))


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		if n == 2:
			print('1\n0')
			continue
		elif n == 3:
			print('1\n1')
			continue
		elif n == 4:
			print('2\n0 1')
			continue
		m = 3
		r = 2
		print_l = ['1']
		while n != m:
			left = n - m
			if left >= r * 4 or left == r * 2:
				print_l.append(str(r))
				r *= 2
			elif left > r * 2:
				print_l.append(str(left // 2 - r))
				r = left // 2
			else:
				print_l.append(str(left - r))
				r = left
			m += r
		print(len(print_l))
		print(' '.join(print_l))
main()


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	if n == 8:
		print(3)
		print(1, 0, 1)
	elif n == 4:
		print(2)
		print(0, 1)
	else:
		b = n.bit_length()
		ans = [1 << i for i in range(b)]
		t = 0
		c = 0
		n = 2 ** b - 1 - n
		for i in range(1, b):
			if n >> b - i & 1:
				t += 1
				c += 1
			ans[i] -= t
			t *= 2
		ans[-1] -= c + (n & 1)
		res = [0] * (b - 1)
		for i in range(b - 1):
			res[i] = ans[i + 1] - ans[i]
		print(b - 1)
		print(' '.join(map(str, res)))


from math import log2, ceil
for _ in range(int(input())):
	n = int(int(input()))
	val = int(log2(n))
	print(val)
	if n <= 3:
		print(n % 2)
	else:
		i = 1
		for _ in range(val - 2):
			print(i, end=' ')
			i *= 2
		exp_m2 = 2 ** (val - 2)
		exp_m1 = exp_m2 * 2
		exp = exp_m1 * 2
		calc = n - (exp_m1 - 1)
		if calc >= 2 ** val:
			print(exp_m1 - exp_m2, calc - exp)
		else:
			print(int(calc / 2) - exp_m2, 0 if calc / 2 == calc // 2 else 1)


from sys import stdin, stdout

def main():
	t = int(stdin.readline())
	for _ in range(t):
		n = int(stdin.readline())
		ans = []
		i = 1
		while i <= n:
			ans.append(i)
			n -= i
			i *= 2
		if n > 0:
			ans.append(n)
			ans.sort()
		print(len(ans) - 1)
		for i in range(1, len(ans)):
			print(ans[i] - ans[i - 1], end=' ')
main()


import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
from itertools import islice, cycle

def go():
	n = int(input())
	(res, curs) = ([1], 1)
	while curs < n:
		res.append(res[-1] * 2)
		curs += res[-1]
	if curs - n <= res[-2]:
		res[-1] -= curs - n
	else:
		res[-1] -= curs - n
		s = res[-1] + res[-2]
		(res[-2], res[-1]) = (s // 2, (s + 1) // 2)
	result = []
	for i in range(len(res) - 1):
		result.append(res[i + 1] - res[i])
	return str(len(result)) + '\n' + ' '.join(map(str, result))
t = int(input())
ans = []
for _ in range(t):
	ans.append(str(go()))
print('\n'.join(ans))


import sys
from collections import defaultdict as dd
from collections import deque

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
from math import *
import copy
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def li():
	return [int(x) for x in input().split()]

def fi():
	return int(input())

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def bo(i):
	return ord(i) - ord('a')
t = fi()

def fundp(i, su):
	global k
	if i == n and su != k:
		return 10 ** 18
	elif i == n:
		return 1
	elif dp[i][su] != -1:
		return dp[i][su]
	dp[i][su] = min(fundp(i + 1, su + a[i]), fundp(i + 1, su))
	return dp[i][su]
while t > 0:
	t -= 1
	n = fi()
	d = []
	s = 0
	p = 1
	g = 1
	while s + p <= n:
		d.append(p)
		s += p
		p = p * 2
	if s != n:
		d.append(n - s)
	d.sort()
	print(len(d) - 1)
	for i in range(1, len(d)):
		print(d[i] - d[i - 1], end=' ')
	print()


import sys
import math

def readStr():
	return sys.stdin.readline().rstrip()

def readInts():
	return list(map(int, readStr().split(' ')))

def main(n):
	d = math.ceil(math.log(n + 1, 2) - 1)
	dd = []
	m = 1
	n -= 1 * (d + 1 - 0)
	for i in range(1, d + 1):
		di = n // (d + 1 - i)
		if di > m:
			di = m
		dd.append(di)
		m += di
		n -= di * (d + 1 - i)
	if n == 0:
		return (d, dd)
	else:
		return (-1, None)
(t,) = readInts()
for _ in range(t):
	(n,) = readInts()
	(d, dd) = main(n)
	print(d)
	if d != -1:
		print(' '.join(map(str, dd)))


import math

def task(n):
	amount = 1
	mass = 1
	days = 0
	adds = []
	while True:
		if mass + 4 * amount <= n:
			news = amount
		elif mass + 2 * amount >= n:
			news = n - mass - amount
		else:
			news = max(0, math.floor((n - mass - amount * 2) / 2))
		amount += news
		adds.append(news)
		mass += amount
		days += 1
		if mass == n:
			break
	print(days)
	print(' '.join(map(str, adds)))
t = int(input())
for i in range(0, t):
	n = int(input())
	task(n)


for t in range(int(input())):
	n = int(input())
	day = len(bin(n)[2:]) - 1
	ans = []
	k = 1
	count = day
	while k <= n:
		ans.append(k)
		n -= k
		k *= 2
	if n > 0:
		ans.append(n)
		ans.sort()
	ans1 = []
	for i in range(1, len(ans)):
		ans1.append(ans[i] - ans[i - 1])
	print(len(ans) - 1)
	print(*ans1)


from math import *

def main():
	t = int(input())
	for tc in range(0, t):
		n = int(input())
		s = 0
		vls = list()
		ct = 0
		while s + (1 << ct) < n:
			vls.append(1 << ct)
			s += 1 << ct
			ct += 1
		if s < n:
			vls.append(n - s)
			vls.sort()
		print(len(vls) - 1)
		for i in range(1, len(vls)):
			print(vls[i] - vls[i - 1], end=' ')
		print()
main()


from math import log2, floor
t = int(input())
for i in range(t):
	n = int(input())
	if n in [2, 3]:
		if n == 2:
			print(1)
			print('0')
		elif n == 3:
			print(1)
			print('1')
	else:
		k = int(floor(log2(n)))
		min = 2 ** k
		max = 2 * min - 1
		num = ''.join((str(2 ** i) + ' ' for i in range(k - 2)))
		if min + 2 ** (k - 2) - 1 >= n:
			num += f'0 {n - min + 1}'
		else:
			min1 = min + 2 ** (k - 2)
			p = floor((n - min1) / 3) + 1
			n1 = n - min + 1
			num += f'{p} {n1 - 2 * p}'
		print(k)
		print(num)


from collections import deque
for _ in range(int(input())):
	n = int(input())
	a = []
	sm = 0
	i = 1
	while sm + i <= n:
		sm += i
		a.append(i)
		i *= 2
	d = n - sm
	if d > 0:
		a.append(d)
	a.sort()
	ans = []
	for i in range(len(a) - 1):
		ans.append(a[i + 1] - a[i])
	print(len(ans))
	print(*ans)


from sys import stdin
import math
a = int(stdin.readline())
for k in range(0, a):
	A = int(stdin.readline())
	A -= 1
	if A == 0:
		print(1)
		print(0)
	print(int(math.floor(math.log2(A + 1))))
	temp = 1
	layer = 1
	while True:
		if A - 2 ** temp < 2 ** temp:
			B = int(math.floor(A / 2))
			if B - 2 ** (temp - 1) >= 0 and A - 2 ** (temp - 1) > layer:
				print(B - 2 ** (temp - 1), end=' ')
				print(A - 2 * B)
			else:
				print(A - 2 ** (temp - 1))
			break
		else:
			print(2 ** (temp - 1), end=' ')
			A -= 2 ** temp
			layer = 2 ** temp
		temp += 1


import sys
readline = sys.stdin.readline
T = int(readline())
Ans = []
M = [1] * 50
for i in range(1, 50):
	M[i] = 2 * M[i - 1] + 1
p2 = [1] * 50
for i in range(1, 50):
	p2[i] = 2 * p2[i - 1]
for qu in range(T):
	N = int(readline())
	for days in range(50):
		if N <= M[days]:
			break
	cnt = days + 1
	pre = 1
	res = [1] * (days + 1)
	for i in range(1, days + 1):
		pre = res[i - 1]
		j = min(pre, (N - cnt) // (days - i + 1))
		cnt += j * (days - i + 1)
		res[i] = j + pre
	res = [r2 - r1 for (r1, r2) in zip(res, res[1:])]
	Ans.append(str(len(res)))
	Ans.append(' '.join(map(str, res)))
print('\n'.join(map(str, Ans)))


import math
import array as arr

def iread():
	return int(input())
for t in range(iread()):
	n = iread()
	accum = 1
	cells = 1
	d = 0
	l = [1]
	while accum + cells * 2 <= n:
		cells *= 2
		accum += cells
		l.append(cells)
	if accum != n:
		l.append(n - accum)
	l.sort()
	print(len(l) - 1)
	for i in range(len(l) - 1):
		print(l[i + 1] - l[i], end=' ')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	bacteria = 1
	tw = 1
	res = []
	while tw < n:
		rem = n - tw
		if bacteria > rem:
			print(1 / 0)
			break
		if rem - bacteria <= bacteria:
			new = rem - bacteria
		else:
			new = max(0, min(bacteria, rem - 3 * bacteria))
		res.append(new)
		bacteria += new
		tw += bacteria
	print(len(res))
	print(*res)


def solve(n):
	weights = []
	count = 1
	total = last_total = 0
	while total <= n:
		weights.append(count)
		last_total = total
		total += count
		count *= 2
	weights.pop()
	if last_total != n:
		weights.append(n - last_total)
		weights.sort()
	res = []
	for i in range(1, len(weights)):
		res.append(weights[i] - weights[i - 1])
	return res
m = int(input())
for _ in range(m):
	n = int(input())
	res = solve(n)
	print(len(res))
	print(' '.join([str(x) for x in res]))


from math import pow
t = int(input())
while t > 0:
	n = int(input())
	su = 0
	i = 0
	k = 0
	arr = []
	while su <= n:
		k = int(pow(2, i))
		su += k
		arr.append(k)
		i += 1
	arr.pop()
	su -= k
	i -= 1
	if su == n:
		print(len(arr) - 1)
	else:
		print(len(arr))
		diff = n - su
		arr.append(diff)
		arr.sort()
	for i in range(1, len(arr)):
		print(arr[i] - arr[i - 1], end=' ')
	print()
	t -= 1


T = int(input())
for _ in range(T):
	N = int(input())
	msb = 0
	x = N
	while x:
		x >>= 1
		msb += 1
	print(msb - 1)
	curr = 1
	N -= msb
	res = []
	for i in range(msb - 1, 0, -1):
		inc = min(curr, N // i)
		res.append(inc)
		curr += inc
		N -= inc * i
	print(*res)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [1]
	i = 1
	sm = 1
	fl = 1
	while 1:
		if sm + 2 ** i == n:
			arr.append(2 ** i)
			fl = -1
			break
		if sm + 2 ** i < n:
			arr.append(2 ** i)
			sm += 2 ** i
		else:
			break
		i += 1
	if fl == 1:
		arr.append(n - sm)
		arr.sort()
	tp = []
	for i in range(1, len(arr)):
		tp.append(arr[i] - arr[i - 1])
	print(len(tp))
	print(*tp)


def read_int():
	return int(input())

def read_ints():
	return map(int, input().split(' '))

def solve():
	n = read_int()
	inc = []
	i = 1
	while i <= n:
		inc.append(i)
		n -= i
		i *= 2
	if n > 0:
		inc.append(n)
		inc.sort()
	print(len(inc) - 1)
	for i in range(1, len(inc)):
		print(inc[i] - inc[i - 1], end=' ')
	print()
t = read_int()
for case_num in range(t):
	solve()


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
mod = 1000000007
import math
import bisect
abc = 'abcdefghijklmnopqrstuvwxyz'

def main():
	l = []
	s = 0
	for i in range(31):
		s += 1 << i
		l.append(s)
	for _ in range(ii()):
		n = ii()
		c = i = 0
		while c < n:
			c += pow(2, i)
			i += 1
		i -= 1
		days = i
		f = [0] * (i + 1)
		for i in range(1, days + 1):
			f[i] = l[i - 1]
		f.append(n)
		d = []
		for i in range(1, len(f)):
			d.append(f[i] - f[i - 1])
		d.sort()
		print(days)
		for i in range(len(d) - 1):
			print(d[i + 1] - d[i], end=' ')
		print()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


T = int(input().strip())
for t in range(T):
	L = int(input().strip())
	cur = 1
	weight = 1
	todiv = []
	while weight < L:
		daydiv = min(L - weight - cur, cur)
		if weight + 2 * (cur + daydiv) > L > weight + cur + daydiv:
			daydiv = (L - weight) // 2 - cur
		todiv.append(daydiv)
		cur += daydiv
		weight += cur
	print(len(todiv))
	print(*todiv)


for _ in range(int(input())):
	arr = []
	n = int(input())
	x = 1
	while x < n:
		arr.append(x)
		n -= x
		x *= 2
	if n > 0:
		arr.append(n)
	arr.sort()
	s = []
	print(len(arr) - 1)
	for i in range(len(arr) - 1):
		s.append(arr[i + 1] - arr[i])
	print(*s)


from bisect import bisect_left, bisect_right
for _ in range(int(input())):
	ar = []
	n = int(input())
	i = 1
	while n - i > 0:
		ar.append(i)
		n -= i
		i *= 2
	if n > 0:
		ar.append(n)
	ar.sort()
	print(len(ar) - 1)
	for i in range(1, len(ar)):
		print(ar[i] - ar[i - 1], end=' ')
	print()


import sys
readline = sys.stdin.readline
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
t = ni()
for i in range(t):
	n = ni()
	q = 1
	z = []
	tq = 1
	while tq < n:
		z.append(q)
		q = q * 2
		tq += q
	tq = tq - q
	if n - tq != 0:
		z.append(n - tq)
	z.sort()
	print(len(z) - 1)
	for j in range(1, len(z)):
		print(z[j] - z[j - 1], end=' ')
	print()


import sys
from collections import defaultdict, deque
import math
import heapq
t = int(sys.stdin.readline())
arr = [[0], [0], [0, 1], [1, 2]]
for _ in range(t):
	n = int(sys.stdin.readline())
	ans = []
	nb = 1
	num = n - 1
	while num > 0:
		x = nb * 2
		newb = x
		if num - x >= newb:
			num -= x
			ans.append(nb)
			nb = newb
		else:
			if num <= 2 * nb:
				ans.append(num - nb)
			else:
				a = math.ceil(num / 2)
				b = math.floor(num / 2)
				if a == b:
					ans.append(a - nb)
					ans.append(0)
				else:
					ans.append(b - nb)
					ans.append(1)
			num = 0
	print(len(ans))
	print(*ans)


def main():
	t = 1
	t = int(input())
	for _ in range(t):
		n = int(input())
		ans = [1]
		n -= 1
		while True:
			if 2 * ans[-1] >= n:
				ans.append(n)
				break
			else:
				ans.append(min(n // 2, 2 * ans[-1]))
				n -= ans[-1]
		print(len(ans) - 1)
		print(*[ans[i + 1] - ans[i] for i in range(len(ans) - 1)])
	return
main()


numcases = int(input())
for i in range(numcases):
	k = int(input())
	count = 0
	ans = []
	while sum(ans) < k:
		ans.append(2 ** count)
		count = count + 1
	if sum(ans) > k:
		ans.pop()
		ans.append(k - sum(ans))
		ans = sorted(ans)
	print(len(ans) - 1)
	for i in range(len(ans) - 1):
		print(ans[i + 1] - ans[i], end=' ')
	print()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	i = 1
	n = int(input())
	ans = []
	while i <= n:
		ans.append(i)
		n -= i
		i *= 2
	if n > 0:
		ans.append(n)
		ans.sort()
	print(len(ans) - 1)
	for i in range(1, len(ans)):
		print(ans[i] - ans[i - 1], end=' ')
	print()


import sys
stdin = sys.stdin
ns = lambda : stdin.readline().rstrip()
ni = lambda : int(stdin.readline().rstrip())
nm = lambda : map(int, stdin.readline().split())
nl = lambda : list(map(int, stdin.readline().split()))

def solve():
	n = ni()
	da = n.bit_length() - 1
	print(da)
	n -= da + 1
	f = [0] * da
	mx = 1
	for i in range(da):
		gr = min(mx, n // (da - i))
		f[i] = gr
		mx += gr
		n -= (da - i) * gr
	print(*f)
t = ni()
for _ in range(t):
	solve()


import sys
input = sys.stdin.readline
(t,) = map(int, input().split())
for _ in range(t):
	N = int(input())
	r = []
	for i in range(100):
		r.append(2 ** i)
		if N <= 2 ** (i + 1) - 1:
			break
	dd = 2 ** (i + 1) - 1 - N
	r[-1] -= dd
	r = sorted(r)
	R = []
	for i in range(1, len(r)):
		R.append(r[i] - r[i - 1])
	print(len(R))
	print(*R)


T = int(input())
for _ in range(T):
	n = int(input())
	nights = 0
	splits = []
	bacteria = 1
	mass = 1
	rem = n - mass
	if n == 2:
		print(1)
		print(0)
	else:
		while rem > 3 * 2 ** (nights + 1):
			nights += 1
			splits.append(bacteria)
			bacteria *= 2
			mass += bacteria
			rem -= bacteria
		if rem == 2 ** (nights + 1):
			nights += 1
			splits.append(bacteria)
		elif rem > 2 ** (nights + 2):
			nights += 2
			splits.append(bacteria)
			splits.append(rem - 4 * bacteria)
		else:
			nights += 2
			splits.append(rem // 2 - bacteria)
			if rem % 2 == 0:
				splits.append(0)
			else:
				splits.append(1)
		print(nights)
		print(*splits)


import math
for _ in range(int(input())):
	n = int(input())
	log = int(math.log2(n + 1))
	nights = log - 1
	pown = 2 ** nights
	num = 1
	if 2 * pown - 1 == n:
		print(nights)
		nights = log - 1
		for i in range(nights):
			print(num, end=' ')
			num *= 2
	elif n < 3 * pown - 1:
		print(nights + 1)
		k = n - (2 * pown - 1)
		m = k // 2
		p = k % 2
		for i in range(nights - 1):
			print(num, end=' ')
			num *= 2
		print(m, end=' ')
		print(p)
	else:
		print(nights + 1)
		p = n - (3 * pown - 1)
		for i in range(nights):
			print(num, end=' ')
			num *= 2
		print(p)


t = int(input())
for _ in range(t):
	n = int(input())
	for i in range(1, 30):
		if 2 ** (i + 1) - 1 >= n:
			print(i)
			for j in range(1, i + 1):
				if j == i - 1 and 2 ** (i - 1) * 3 - 1 > n:
					print((n - 2 ** i + 1) // 2, end=' ')
					print((n - 2 ** i + 1) % 2)
					break
				elif j == i:
					print(n - 3 * 2 ** (i - 1) + 1)
				else:
					print(2 ** (j - 1), end=' ')
			break


for _ in range(int(input())):
	n = int(input())
	x = 1
	r = 1
	val = [1]
	if n == 2:
		print(1)
		print(0)
	else:
		while x <= n:
			z = x
			z += 2 ** r
			if z > n:
				break
			x += 2 ** r
			val.append(2 ** r)
			r += 1
		if x == n:
			print(len(val) - 1)
			for i in range(1, len(val)):
				print(val[i] - val[i - 1], end=' ')
			print()
		else:
			val.append(n - x)
			val.sort()
			print(len(val) - 1)
			for i in range(1, len(val)):
				print(val[i] - val[i - 1], end=' ')
			print()


import math
t = int(input())
for tt in range(t):
	n = int(input())
	arr = []
	ss = n
	cc = 1
	while ss > 0:
		if ss < cc:
			break
		arr.append(cc)
		ss -= cc
		cc *= 2
	if ss > 0:
		arr.append(ss)
		arr.sort()
	print(len(arr) - 1)
	for i in range(1, len(arr)):
		print(arr[i] - arr[i - 1], end=' ')
	print()


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		n = int(input())
		d = 0
		pw = 2
		while pw <= n:
			d += 1
			pw *= 2
		n -= d + 1
		res = [0] * d
		for i in range(d):
			res[i] = min(2 ** i, n // (d - i))
			n -= res[i] * (d - i)
		print(d)
		print(' '.join(map(str, res)))
	q = int(input())
	for _ in range(q):
		solve()
main()


N = int(input())
for _ in range(N):
	n = int(input())
	res = []
	two = 1
	while two * 2 <= n:
		res.append(two)
		two *= 2
	res.append(two)
	s = sum(res) - n
	two //= 2
	result = []
	for i in reversed(res):
		if s >= two:
			s -= two
			result.append(i - two)
		else:
			result.append(i - s)
			s = 0
		two //= 2
	print(len(result) - 1)
	result = list(reversed(result))
	print(' '.join([str(j - i) for (i, j) in zip(result, result[1:])]))


t = int(input())
for test in range(0, t):
	n = int(input())
	lis = []
	tot = 1
	day = 1
	while tot <= n:
		lis.append(day)
		day *= 2
		tot += day
	tot -= day
	if n > tot:
		lis.append(n - tot)
	lis.sort()
	print(len(lis) - 1)
	for i in range(1, len(lis)):
		print(lis[i] - lis[i - 1], end=' ')
	print('')


import sys
input = sys.stdin.readline
from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	weight = 1
	for day in range(1, 33):
		weight += 2 ** day
		if weight >= n:
			break
	mutation = [2 ** item for item in range(day + 1)]
	diff = weight - n
	for i in range(day + 1):
		dim = 2 ** (day - i + 1) - 1
		if dim <= diff:
			cnt = diff // dim
			for j in range(day - i + 1):
				mutation[i + j] -= 2 ** j * cnt
				diff -= 2 ** j * cnt
	ans = []
	for (m1, m2) in zip(mutation, mutation[1:]):
		ans.append(m2 - m1)
	print(len(ans))
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	l = []
	i = 1
	s = 0
	j = 1
	while s + i <= n:
		s += i
		l.append(i)
		i = 2 ** j
		j += 1
	if s < n:
		l.append(n - s)
		l.sort()
	print(len(l) - 1)
	for i in range(len(l) - 1):
		print(l[i + 1] - l[i], end=' ')
	print()


import math as mt
import sys
import collections as cc
input = sys.stdin.buffer.readline
I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	(n,) = I()
	ans = []
	i = 1
	while i <= n:
		ans.append(i)
		n -= i
		i *= 2
	if n != 0:
		ans.append(n)
		ans.sort()
	print(len(ans) - 1)
	for i in range(len(ans) - 1):
		print(abs(ans[i] - ans[i + 1]), end=' ')
	print()


q = int(input())
for _ in range(q):
	n = int(input())
	if n == 2:
		print(1)
		print(0)
	else:
		sumka = 1
		noc = 0
		odp = []
		while 2 * (sumka * 2 + 1) + 1 <= n:
			odp.append((sumka + 1) // 2)
			sumka = sumka * 2 + 1
			noc += 1
		if 2 * sumka + 1 == n:
			print(noc + 1)
			odp.append((sumka + 1) // 2)
			print(*odp)
		else:
			print(noc + 2)
			ls = 0
			ps = 2 ** noc
			cyk = -12093123
			while abs(ls - ps) > 0:
				ms = (ls + ps + 1) // 2
				masa = 2 ** (noc + 1) - 1 + 2 ** noc + ms
				dodysp = 2 ** noc + ms
				interval = [masa + dodysp, masa + 2 * dodysp]
				if n >= interval[0] and n <= interval[1]:
					cyk = ms
					break
				elif n < interval[0]:
					ps = ms - 1
				else:
					ls = ms
			if cyk < 0:
				cyk = (ls + ps) // 2
			odp.append(cyk)
			odp.append(n - 2 ** (noc + 2) + 1 - 2 * cyk)
			print(*odp)


MOD = 10 ** 9 + 7

def main():
	for _ in inputt():
		(n,) = inputi()
		t = floor(log2(n))
		print(t)
		n -= t + 1
		d = 1
		for i in range(t):
			z = n // (t - i)
			z = min(z, d)
			d += z
			n -= z * (t - i)
			print(z, end=' ')
		print()
from math import *
from heapq import *
from itertools import *
from functools import reduce, lru_cache, partial
from collections import Counter, defaultdict
import re, copy, operator, cmath
import sys, io, os, builtins
sys.setrecursionlimit(1000)
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(io.IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	if args:
		sys.stdout.write(str(args[0]))
		split = kwargs.pop('split', ' ')
		for arg in args[1:]:
			sys.stdout.write(split)
			sys.stdout.write(str(arg))
	sys.stdout.write(kwargs.pop('end', '\n'))

def debug(*args, **kwargs):
	print('debug', *args, **kwargs)
	sys.stdout.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip()
inputt = lambda t=0: range(t) if t else range(int(input()))
inputs = lambda : input().split()
inputi = lambda k=int: map(k, inputs())
inputl = lambda t=0, k=lambda : list(inputi()): [k() for _ in range(t)] if t else list(k())

def len(a):
	if isinstance(a, range):
		return -((a.start - a.stop) // a.step)
	return builtins.len(a)

def bisect_left(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if key(a[mid]) < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def bisect_right(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if x < key(a[mid]):
			hi = mid
		else:
			lo = mid + 1
	return lo

def insort_left(a, x, key=None, lo=0, hi=None):
	lo = bisect_left(a, x, key, lo, hi)
	a.insert(lo, x)

def insort_right(a, x, key=None, lo=0, hi=None):
	lo = bisect_right(a, x, key, lo, hi)
	a.insert(lo, x)
do_nothing = lambda x: x
bisect = bisect_right
insort = insort_right

def index(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi and key(a[i]) == x:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_lt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_le(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_gt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_ge(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError

class Tree:

	def __init__(n):
		self._n = n
		self._conn = [[] for _ in range(n)]
		self._list = [0] * n

	def connect(a, b):
		pass

class Sieve:

	def __init__(self):
		self._n = 6
		self._list = [2, 3, 5, 7, 11, 13]

	def extend(self, n):
		if n <= self._list[-1]:
			return
		maxbase = int(n ** 0.5) + 1
		self.extend(maxbase)
		begin = self._list[-1] + 1
		newsieve = [i for i in range(begin, n + 1)]
		for p in self.primerange(2, maxbase):
			for i in range(-begin % p, len(newsieve), p):
				newsieve[i] = 0
		self._list.extend([x for x in newsieve if x])

	def extend_to_no(self, i):
		while len(self._list) < i:
			self.extend(int(self._list[-1] * 1.5))

	def primerange(self, a, b):
		a = max(2, a)
		if a >= b:
			return
		self.extend(b)
		i = self.search(a)[1]
		maxi = len(self._list) + 1
		while i < maxi:
			p = self._list[i - 1]
			if p < b:
				yield p
				i += 1
			else:
				return

	def search(self, n):
		if n < 2:
			raise ValueError
		if n > self._list[-1]:
			self.extend(n)
		b = bisect(self._list, n)
		if self._list[b - 1] == n:
			return (b, b)
		else:
			return (b, b + 1)

	def __contains__(self, n):
		if n < 2:
			raise ValueError
		if not n % 2:
			return n == 2
		(a, b) = self.search(n)
		return a == b

	def __getitem__(self, n):
		if isinstance(n, slice):
			self.extend_to_no(n.stop + 1)
			return self._list[n.start:n.stop:n.step]
		else:
			self.extend_to_no(n + 1)
			return self._list[n]
sieve = Sieve()

def isprime(n):
	if n <= sieve._list[-1]:
		return n in sieve
	for i in sieve:
		if not n % i:
			return False
		if n < i * i:
			return True
prime = sieve.__getitem__
primerange = lambda a, b=0: sieve.primerange(a, b) if b else sieve.primerange(2, a)

def factorint(n):
	factors = []
	for i in sieve:
		if n < i * i:
			break
		while not n % i:
			factors.append(i)
			n //= i
	if n != 1:
		factors.append(n)
	return factors
factordict = lambda n: Counter(factorint(n))
main()


t = int(input())
import bisect
for _ in range(t):
	n = int(input())
	s = 0
	A = []
	x = 0
	while True:
		if s > n:
			s -= 2 ** (x - 1)
			A.pop()
			break
		A.append(2 ** x)
		s += 2 ** x
		x += 1
	if n == s:
		B = []
		for i in range(len(A) - 1):
			B.append(A[i + 1] - A[i])
		print(len(B))
		print(*B)
	else:
		y = n - s
		A.append(y)
		A.sort()
		B = []
		for i in range(len(A) - 1):
			B.append(A[i + 1] - A[i])
		print(len(B))
		print(*B)


t = int(input())

def ord2(k):
	i = 0
	while k:
		k //= 2
		i += 1
	return i

def binsearch(nums, val, l, h):
	if nums[h] <= val:
		return h
	if nums[0] > val:
		return -1
	if l + 1 >= h:
		return l
	m = (l + h) // 2
	if val >= nums[m]:
		return binsearch(nums, val, m, h)
	return binsearch(nums, val, l, m)

def sol():
	n = int(input())
	k = ord2(n)
	nbs = []
	i = 1
	pw2 = 0
	while pw2 < k - 1:
		nbs.append(i)
		i *= 2
		pw2 += 1
	d = n + 1 - i
	ix = binsearch(nbs, d, 0, k - 2)
	nbs.insert(ix + 1, d)
	res = []
	for i in range(1, k):
		res.append(str(nbs[i] - nbs[i - 1]))
	return '%d\n%s' % (k - 1, ' '.join(res))
for _ in range(t):
	print(sol())


from sys import stdin
input = stdin.readline
mod = int(1000000000.0 + 7)

def put():
	return map(int, input().split())

def fail():
	print(-1)
	exit()

def seive(N):
	factor = []
	x = N
	i = 2
	while i ** 2 <= N:
		if x % i == 0:
			factor.append(i)
		while x % i == 0:
			x //= i
		i += 1
	if x > 1:
		factor.append(x)
	return factor
for _ in range(int(input())):
	n = int(input())
	(i, l) = (1, [])
	while i <= n:
		n -= i
		l.append(i)
		i *= 2
	if n:
		l.append(n)
	l.sort()
	print(len(l) - 1)
	for i in range(1, len(l)):
		print(l[i] - l[i - 1], end=' ')
	print()


for t in range(int(input())):
	n = int(input())
	l = []
	i = 1
	while i < n + 1:
		l.append(i)
		n = n - i
		i = i * 2
	if n > 0:
		l.append(n)
		l.sort()
	print(len(l) - 1)
	for i in range(1, len(l)):
		print(l[i] - l[i - 1], end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	gap = n - 1
	bact = 1
	days = []
	while gap != 0:
		if gap <= 2 * bact:
			days.append(gap - bact)
			bact = gap
			break
		if gap >= 4 * bact:
			days.append(bact)
			bact *= 2
		else:
			new_bact = gap // 2
			days.append(new_bact - bact)
			bact = new_bact
		gap -= bact
	print(len(days))
	print(' '.join(map(str, days)))


cases = int(input())

def fn1(x):
	return 2 ** (x + 1) - 1

def gen(x):
	genned = []
	for i in range(x):
		genned.append(2 ** i)
	return genned
for i in range(cases):
	final = int(input())
	d = 1
	while fn1(d) < final:
		d += 1
	remain = final - fn1(d - 1)
	additions = gen(d)
	if remain != 0:
		additions.append(remain)
		additions.sort()
	split = []
	for j in range(1, len(additions)):
		split.append(additions[j] - additions[j - 1])
	split_str = ''
	for j in range(len(split)):
		split_str = split_str + str(split[j]) + ' '
	print(d)
	print(split_str)


def solve(m, n, N):
	if N - m - n <= n:
		return [N - m - n]
	elif m + 4 * n > N:
		if (N - m - 2 * n) % 2 == 0:
			return [(N - m - 2 * n) // 2, 0]
		else:
			return [(N - m - 2 * n) // 2, 1]
	return [n] + solve(m + 2 * n, 2 * n, N)
for _ in range(int(input())):
	n = int(input())
	s = solve(1, 1, n)
	print(len(s))
	print(*s)


t = int(input())
for _ in range(t):
	n = int(input())
	acc = 0
	l = []
	p = 1
	while acc + p <= n:
		acc += p
		l.append(p)
		p *= 2
	if n - acc > 0:
		l.append(n - acc)
	l.sort()
	ans = []
	for i in range(len(l) - 1):
		ans.append(l[i + 1] - l[i])
	print(len(ans))
	print(*ans)


t = int(input())
sol = []
for tc in range(t):
	n = int(input())
	idx = 0
	for i in range(31):
		if 2 ** i > n:
			idx = i - 1
			break
	arr = [2 ** i for i in range(idx)]
	arr.append(n - (2 ** idx - 1))
	arr.sort()
	diff = []
	for i in range(len(arr) - 1):
		diff.append(arr[i + 1] - arr[i])
	sol.append(diff)
for s in sol:
	print(len(s))
	print(*s)


import sys
sys.setrecursionlimit(100000)

def main():
	n = int(input())
	to_take = dict()
	st = 2
	n -= 1
	to_take[1] = 0
	to_take[2] = 0
	while n > 0:
		if st > n:
			if n == 0:
				break
			elif n in to_take:
				to_take[n] += 1
			else:
				to_take[n] = 1
			break
		if not st in to_take:
			to_take[st] = 0
		to_take[st] += 1
		n -= st
		if st > n:
			if n == 0:
				break
			elif n in to_take:
				to_take[n] += 1
			else:
				to_take[n] = 1
			break
		elif st < n:
			st *= 2
	to_del = []
	days = 0
	for i in to_take:
		if to_take[i] == 0:
			to_del.append(i)
		days += to_take[i]
	for i in to_del:
		del to_take[i]
	in_to_take = sorted(list(to_take))
	line = ''
	line += str(in_to_take[0] // 2) + ' '
	line += '0 ' * (to_take[in_to_take[0]] - 1)
	for i in range(1, len(in_to_take)):
		line += str(in_to_take[i] - in_to_take[i - 1]) + ' '
		line += '0 ' * (to_take[in_to_take[i]] - 1)
	print(days)
	print(line)
t = int(input())
for i in range(t):
	main()
1 + 2 + 3 + 4 + 8 + 8


import math
t = int(input())
while t:
	n = int(input())
	a = [1]
	s = 1
	i = 1
	while s + 2 ** i <= n:
		s += 2 ** i
		a.append(2 ** i)
		i += 1
	if s < n:
		x = n - s
		a.append(x)
	a.sort()
	b = []
	for i in range(1, len(a)):
		b.append(a[i] - a[i - 1])
	print(len(b))
	for i in range(len(b)):
		if i == len(b) - 1:
			print(b[i])
		else:
			print(b[i], end=' ')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	a = []
	(p, s) = (1, 0)
	while p <= n:
		a.append(p)
		n -= p
		p *= 2
	if n > 0:
		a.append(n)
	a.sort()
	d = len(a)
	ans = []
	for i in range(1, len(a)):
		ans.append(a[i] - a[i - 1])
	print(d - 1)
	print(*ans)


import sys
input = sys.stdin.readline
import math
for _ in range(int(input())):
	n = int(input())
	total = 1
	arr = []
	arr.append(1)
	while total + arr[len(arr) - 1] * 2 < n:
		total += arr[len(arr) - 1] * 2
		arr.append(arr[len(arr) - 1] * 2)
	if total != n:
		temp = n - total
		arr.append(temp)
		arr.sort()
	print(len(arr) - 1)
	for i in range(1, len(arr)):
		print(arr[i] - arr[i - 1], end=' ')
	print()


from math import log2 as log
for _ in range(int(input())):
	n = int(input())
	k = int(log(n + 1))
	s = 2 ** k - 1
	d = n - s
	f = 0
	if d == 0:
		f = 1
	b = []
	for i in range(k):
		if 2 ** i < d:
			b.append(1 << i)
		elif 2 ** i >= d:
			if f == 0:
				b.append(d)
				b.append(1 << i)
				f = 1
			else:
				b.append(1 << i)
	if d > 2 ** (k - 1):
		b.append(d)
	e = b
	e = [b[i] - b[i - 1] for i in range(1, len(b))]
	print(len(e))
	print(*e)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [1]
	sum = 1
	while sum < n:
		a.append(a[-1] * 2)
		sum += a[-1]
	if sum > n:
		a[-1] = a[-1] - (sum - n)
		a = list(sorted(a))
	print(len(a) - 1)
	print(*[a[i] - a[i - 1] for i in range(1, len(a))])


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
for _ in range(int(inp())):
	n = iinp()
	ansl = []
	i = 1
	s = 0
	while s + i <= n:
		ansl.append(i)
		s += i
		i <<= 1
	if s != n:
		ansl.append(n - s)
	ansl.sort()
	nl = [ansl[i + 1] - ansl[i] for i in range(len(ansl) - 1)]
	print(len(nl))
	print(*nl)


test = int(input())
for tes in range(test):
	n = int(input())
	s = 1
	lx = [1]
	i = 1
	while s <= n:
		s += 2 ** i
		lx.append(2 ** i)
		i += 1
	if s > n:
		s -= lx[-1]
		lx.remove(lx[-1])
	if s < n:
		lx.append(n - s)
	lx.sort()
	ans = []
	for x in range(1, len(lx)):
		ans.append(lx[x] - lx[x - 1])
	print(len(ans))
	print(*ans)


for ct in range(int(input())):
	n = int(input())
	res = []
	soma = 0
	i = 0
	while True:
		if soma == n:
			break
		num = 2 ** i
		i += 1
		if soma + num > n:
			num = n - soma
		soma += num
		res.append(num)
	res.sort()
	r = []
	for i in range(1, len(res)):
		r.append(res[i] - res[i - 1])
	print(len(r))
	print(*r)


t = int(input())
for _ in range(t):
	n = int(input())
	k = 1
	d = 0
	n = n - 1
	splits = []
	while n > 0:
		if 2 * k >= n:
			split = n - k
		else:
			split = min(k, n // 2 - k)
		d += 1
		splits.append(split)
		k += split
		n -= k
	print(d)
	print(' '.join(map(str, splits)))


from collections import defaultdict as dc
from heapq import *
import math
import bisect
import sys
from collections import deque as dq
from heapq import heapify, heappush, heappop
mod = 10 ** 9 + 7

def inp():
	p = int(input())
	return p

def line():
	p = list(map(int, input().split()))
	return p

def read_mat():
	n = inp()
	a = []
	for i in range(n):
		a.append(line())
	return a

def digit(n):
	s = str(n)
	p = 0
	for i in s:
		p += int(i) ** 2
	return p

def solve(a):
	i = 1
	p = []
	while i <= a:
		p.append(i)
		a = a - i
		i = i * 2
	if a > 0:
		p.append(a)
	p.sort()
	ans = []
	for i in range(1, len(p)):
		ans.append(p[i] - p[i - 1])
	return ans
for test in range(inp()):
	a = inp()
	l = solve(a)
	print(len(l))
	print(*l)


import sys

def I():
	return sys.stdin.readline().rstrip()
for _ in range(int(I())):
	n = int(I())
	l = [1]
	n -= 1
	while n >= l[-1]:
		m = min(2 * l[-1], n)
		n -= m
		l.append(m)
	if n:
		l.append(n)
	l.sort()
	a = [l[i + 1] - l[i] for i in range(len(l) - 1)]
	print(len(a))
	print(*a)


for i in range(int(input())):
	n = int(input())
	ans = [1]
	now = 2
	s = 1
	while s + now <= n:
		s += now
		ans.append(now)
		now <<= 1
	if s != n:
		ans.append(n - s)
	ans.sort()
	print(len(ans) - 1)
	for i in range(1, len(ans)):
		print(ans[i] - ans[i - 1], end=' ')
	print()


def main():
	from bisect import bisect_left as bl, bisect_right as br, insort
	import sys, heapq, math
	from collections import defaultdict as dd, deque

	def data():
		return sys.stdin.readline().strip()

	def mdata():
		return list(map(int, data().split()))
	out = sys.stdout.write
	INF = int(1000000000.0)
	mod = int(1000000000.0) + 7
	for t in range(int(data())):
		n = int(data())
		p = 2
		n1 = n - 1
		l = []
		while n1:
			if n1 >= p:
				n1 -= p
				l.append(p // 2)
			else:
				break
			p *= 2
		if n1 == 0:
			out(str(len(l)) + '\n')
			out(' '.join(map(str, l)) + '\n')
		else:
			p = 2
			cnt = 0
			while n1 // p != 0:
				p *= 2
				cnt += 1
			p //= 2
			k = n1 - p
			ans = []
			for i in range(cnt):
				ans.append(l[i])
			ans.append(n1 - p)
			if len(ans) < len(l) + 1:
				ans.append(p - k)
			for i in range(cnt + 1, len(l)):
				ans.append(l[i])
			out(str(len(ans)) + '\n')
			out(' '.join(map(str, ans)) + '\n')
main()


from bisect import *
from collections import *
from math import gcd, ceil, sqrt, floor, inf
from heapq import *
from itertools import *
from functools import *
from collections import deque
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc
farr = [1]
ifa = []

def fact(x, mod=0):
	if mod:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr) % mod)
	else:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr))
	return farr[x]

def ifact(x, mod):
	global ifa
	fact(x, mod)
	ifa.append(pow(farr[-1], mod - 2, mod))
	for i in range(x, 0, -1):
		ifa.append(ifa[-1] * i % mod)
	ifa.reverse()

def per(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return fact(i) // fact(i - j)
	return farr[i] * ifa[i - j] % mod

def com(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return per(i, j) // fact(j)
	return per(i, j, mod) * ifa[j] % mod

def catalan(n):
	return com(2 * n, n) // (n + 1)

def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def lowbit(n):
	return n & -n

def inverse(a, m):
	a %= m
	if a <= 1:
		return a
	return (1 - inverse(m, a) * m) // a % m

class BIT:

	def __init__(self, arr):
		self.arr = arr
		self.n = len(arr) - 1

	def update(self, x, v):
		while x <= self.n:
			self.arr[x] += v
			x += x & -x

	def query(self, x):
		ans = 0
		while x:
			ans += self.arr[x]
			x &= x - 1
		return ans

class DSU:

	def __init__(self, n):
		self.c = [-1] * n

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def find(self, x):
		if self.c[x] < 0:
			return x
		self.c[x] = self.find(self.c[x])
		return self.c[x]

	def union(self, u, v):
		(u, v) = (self.find(u), self.find(v))
		if u == v:
			return False
		if self.c[u] > self.c[v]:
			(u, v) = (v, u)
		self.c[u] += self.c[v]
		self.c[v] = u
		return True

	def size(self, x):
		return -self.c[self.find(x)]

class UFS:

	def __init__(self, n):
		self.parent = [i for i in range(n)]
		self.ranks = [0] * n

	def find(self, x):
		if x != self.parent[x]:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, u, v):
		(pu, pv) = (self.find(u), self.find(v))
		if pu == pv:
			return False
		if self.ranks[pu] >= self.ranks[pv]:
			self.parent[pv] = pu
			if self.ranks[pv] == self.ranks[pu]:
				self.ranks[pu] += 1
		else:
			self.parent[pu] = pv

def Prime(n):
	c = 0
	prime = []
	flag = [0] * (n + 1)
	for i in range(2, n + 1):
		if not flag[i]:
			prime.append(i)
			c += 1
		for j in range(c):
			if i * prime[j] > n:
				break
			flag[i * prime[j]] = prime[j]
			if i % prime[j] == 0:
				break
	return prime

def dij(s, graph):
	d = {}
	d[s] = 0
	heap = [(0, s)]
	seen = set()
	while heap:
		(dis, u) = heappop(heap)
		if u in seen:
			continue
		seen.add(u)
		for (v, w) in graph[u]:
			if v not in d or d[v] > d[u] + w:
				d[v] = d[u] + w
				heappush(heap, (d[v], v))
	return d

def GP(it):
	return [[ch, len(list(g))] for (ch, g) in groupby(it)]

def lcm(a, b):
	return a * b // gcd(a, b)

class DLN:

	def __init__(self, val):
		self.val = val
		self.pre = None
		self.next = None

def nb(i, j):
	for (ni, nj) in [[i + 1, j], [i - 1, j], [i, j - 1], [i, j + 1]]:
		if 0 <= ni < n and 0 <= nj < m:
			yield (ni, nj)

@bootstrap
def gdfs(r, p):
	if len(g[r]) == 1 and p != -1:
		yield None
	for ch in g[r]:
		if ch != p:
			yield gdfs(ch, r)
	yield None

def topo(n):
	q = deque()
	res = []
	for i in range(1, n + 1):
		if ind[i] == 0:
			q.append(i)
			res.append(i)
	while q:
		u = q.popleft()
		for v in g[u]:
			ind[v] -= 1
			if ind[v] == 0:
				q.append(v)
				res.append(v)
	return res
t = N()
for i in range(t):
	n = N()
	res = [2]
	cur = 2
	w = 3
	while w < n:
		cur *= 2
		res.append(cur)
		w += cur
	ans = len(res)
	j = len(res) - 1
	while w > n:
		if j:
			if w - n <= res[j - 1]:
				res[j] -= w - n
				w = n
			else:
				res[j] = res[j - 1]
				w -= res[j - 1]
				j -= 1
		else:
			res[j] -= 1
			w -= 1
	pre = 1
	for i in range(len(res)):
		(pre, res[i]) = (res[i], res[i] - pre)
	print(ans)
	print(*res)


t = int(input())
for i in range(t):
	n = int(input())
	l = [1]
	power = 1
	while sum(l) + power * 2 < n:
		power = power * 2
		l.append(power)
	diff = n - (power - 1)
	max_val = l[-1]
	l[-1] = min(diff // 2, max_val)
	l.append(diff - l[-1])
	print(len(l) - 1)
	splits = [l[i] - l[i - 1] for i in range(1, len(l))]
	print(' '.join((str(x) for x in splits)))


ds = [2 ** i - 1 for i in range(1, 32)]
import math

def slv(n):
	ins = 0
	while ds[ins] < n:
		ins += 1
	ans = [2 ** i for i in range(ins)]
	d = ds[ins] - n
	if d <= ans[-1]:
		ans[-1] -= d
		return ans
	else:
		d -= ans[-1]
		ans[-1] = 0
		ans[-2] -= math.ceil(d / 2)
		ans[-1] = d % 2
		return ans
t = int(input())
for _ in range(t):
	n = int(input())
	ans = slv(n)
	print(len(ans))
	print(' '.join(map(str, ans)))


import bisect
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())
for _ in range(int(input())):
	n = int(input())
	arr = []
	i = 1
	while n >= i:
		arr.append(i)
		n -= i
		i *= 2
	if n != 0:
		arr.append(n)
	arr.sort()
	print(len(arr) - 1)
	for i in range(len(arr) - 1):
		print(arr[i + 1] - arr[i], end=' ')
	print()


def solve():
	n = int(input())
	k = 1
	a = []
	while n >= k:
		a.append(k)
		n -= k
		k *= 2
	if n > 0:
		a.append(n)
	a.sort()
	print(len(a) - 1)
	for i in range(len(a) - 1):
		print(a[i + 1] - a[i], end=' ')
	print()
for t in range(int(input())):
	solve()


T = int(input())
while T > 0:
	goal = int(input())
	process = []
	n = 1
	temp = 1
	while temp <= goal:
		n += 1
		temp += 2 ** (n - 1)
		process.append(2 ** (n - 2))
	process.pop()
	n -= 1
	total = 2 ** n - 1
	left = goal - total
	if left > 0:
		prev = 2 ** (n - 1)
		if left >= prev:
			process.append(left - prev)
		else:
			process.pop()
			left += prev
			x = left // 2
			process.append(x - prev // 2)
			if left % 2 == 1:
				process.append(1)
			else:
				process.append(0)
		n += 1
	ans = ''
	print(n - 1)
	for i in range(len(process) - 1):
		ans += str(process[i])
		ans += ' '
	ans += str(process[-1])
	print(ans)
	T -= 1


lis = [0] * 32
aa = [0] * 32
prev = 1
for i in range(31):
	aa[i + 1] = prev
	lis[i] = lis[i - 1] + prev
	prev *= 2
for _ in range(int(input())):
	n = int(input())
	c = 0
	dif = 0
	for i in range(32):
		if lis[i] > n:
			c = i
			break
	if n - lis[c - 1] == 0:
		print(len(aa[1:c]))
		print(*aa[1:c])
	else:
		a = [0] + aa[1:c + 1]
		ss = lis[c - 1] + 1
		i = 1
		while ss != n:
			a[i - 1] = a[i]
			a[i] = 0
			ss += a[i - 1]
			if ss > n:
				a[i - 1] -= ss - n
				a[i] = ss - n
				break
			i += 1
		print(len(a[:-1]))
		print(*a[:-1])


from collections import deque
from collections import OrderedDict
import math
import sys
import os
from io import BytesIO
sumSeq = [0] * 33
for i in range(33):
	sumSeq[i] = 2 ** i
for t in range(int(input())):
	n = int(input())
	sumHave = 0
	countAnswer = 0
	answerSeq = [0] * 33
	for i in range(33):
		answerSeq[i] = 2 ** i
	while sumHave != n:
		countAnswer = 0
		sumHave = 0
		i = 0
		while sumHave < n:
			sumHave += answerSeq[i]
			i += 1
			countAnswer += 1
		rest = sumHave - n
		j = 0
		tempSum = 0
		while tempSum + sumSeq[j] <= rest:
			tempSum += sumSeq[j]
			j += 1
		countNumber = j
		i -= 1
		j -= 1
		for l in range(countNumber):
			answerSeq[i] -= 2 ** j
			i -= 1
			j -= 1
	print(countAnswer - 1)
	for i in range(1, countAnswer):
		print(answerSeq[i] - answerSeq[i - 1], end=' ')


t = int(input())
for _ in range(t):
	nokori = int(input()) - 1
	ba = 1
	ans = []
	while True:
		if nokori <= 2 * ba:
			ans.append(nokori - ba)
			break
		elif 4 * ba <= nokori:
			nokori -= ba * 2
			ans.append(ba)
			ba += ba
		else:
			hueru = nokori // 2
			nokori -= hueru
			ans.append(hueru - ba)
			ba = hueru
	print(len(ans))
	print(*ans)


import sys
import math as mt
import bisect
input = sys.stdin.buffer.readline
t = int(input())
for __ in range(t):
	n = int(input())
	l = []
	suma = 1
	j = 1
	l.append(1)
	while suma + 2 ** j <= n:
		suma += 2 ** j
		l.append(2 ** j)
		j += 1
	if suma != n:
		ind = bisect.bisect(l, n - suma)
		l.insert(ind, n - suma)
	print(len(l) - 1)
	for i in range(1, len(l)):
		print(l[i] - l[i - 1], end=' ')
	print()


import sys
from collections import defaultdict
from copy import copy
R = lambda t=int: t(input())
RL = lambda t=int: [t(x) for x in input().split()]
RLL = lambda n, t=int: [RL(t) for _ in range(n)]

def solve():
	n = R()
	b = 1
	m = 1
	d = 0
	S = []
	while b < n:
		if b + 2 * m >= n:
			S += [n - b - m]
			m += n - b - m
			b += m
		else:
			if b + 4 * m > n:
				x = (n - b) // 2 - m
				S += [x]
				m += x
			else:
				S += [m]
				m *= 2
			b += m
		d += 1
	print(d)
	for c in S:
		print(c, end=' ')
	print()
T = R()
for _ in range(T):
	solve()


from sys import setrecursionlimit
from collections import deque
import heapq
import functools

def IntInput():
	return int(input())

def M_IntInput():
	return map(int, input().split())

def M_StrInput():
	return map(int, input().split())

def IntArrayInput():
	return list(map(int, input().split()))

def modInverse(p, a, m):
	return p % m * pow(a % m, m - 2, m) % m

def compare(item1, item2):
	return item2[0] - item1[0] if item1[0] != item2[0] else item1[1] - item2[1]

def DFS(s, n, paths, answer):
	visited = [False] * (n + 1)
	stack = []
	stack.append(s)
	visited[s] = True
	DFSArray = []
	while stack:
		s = stack.pop()
		DFSArray.append(s)
		flag = 0
		for i in paths[s]:
			if visited[i] == False:
				flag = 1
				stack.append(i)
				visited[i] = True
		if not flag:
			answer[s - 1][1] = 0
	while DFSArray != []:
		s = DFSArray.pop()
		if answer[s - 1][1] < 0:
			answer[s - 1][1] = 0
			for i in paths[s]:
				if answer[i - 1][1] >= 0:
					answer[s - 1][1] += answer[i - 1][1] + 1
	return answer

def BFS(s, n, paths, answer):
	visited = [False] * (n + 1)
	answer[s - 1][0] = 0
	queue = deque()
	queue.append(s)
	visited[s] = True
	while queue:
		s = deque.popleft(queue)
		for i in paths[s]:
			if visited[i] == False:
				queue.append(i)
				answer[i - 1][0] = answer[s - 1][0] + 1
				visited[i] = True
	return answer
numbers = ['1110111', '0010010', '1011101', '1011011', '0111010', '1101011', '1101111', '1010010', '1111111', '1111011']
Dict_Numbers = {'1110111': 0, '0010010': 1, '1011101': 2, '1011011': 3, '0111010': 4, '1101011': 5, '1101111': 6, '1010010': 7, '1111111': 8, '1111011': 9}
for _ in range(int(input())):
	n = int(input())
	array = [1]
	sumV = 1
	while sumV != n:
		if sumV + 2 * array[-1] <= n:
			sumV += array[-1] * 2
			array.append(2 * array[-1])
		else:
			array.append(n - sumV)
			sumV = n
	array.sort()
	ans = []
	for i in range(1, len(array)):
		ans.append(str(array[i] - array[i - 1]))
	print(len(array) - 1)
	print(' '.join(ans))


n = int(input())
while n > 0:
	n = n - 1
	l = []
	s = 0
	m = int(input())
	i = 1
	while i <= m:
		if s + i <= m:
			s += i
			l.append(i)
		i *= 2
	if s < m:
		l.append(m - s)
	l1 = sorted(l)
	print(len(l1) - 1)
	for j in range(1, len(l1)):
		print(l1[j] - l1[j - 1], end=' ')
	print()


import sys
t = int(input())
for _ in range(t):
	n = int(input())
	inc = 1
	res = []
	while inc < n:
		n -= inc
		res.append(inc)
		inc *= 2
	res.append(n)
	res.sort()
	res = [res[i] - res[i - 1] for i in range(1, len(res))]
	print(len(res))
	for x in res:
		print(x, end=' ')
	print()


t = int(input())
ans = []
m = [int(input()) for x in range(t)]
for x in range(t):
	targetM = m[x]
	mass = 1
	n = 1
	night = 0
	prevMass = 0
	prevN = 0
	splits = []
	while mass < targetM:
		prevMass = mass
		prevN = n
		splits.append(n)
		mass = 2 * mass + 1
		n = 2 * n
		night += 1
	if mass == targetM:
		ans.append(night)
		ans.append(' '.join((str(elem) for elem in splits)))
	else:
		s = targetM - prevMass - prevN
		if s >= 0:
			splits[-1] = s
		else:
			s = int(targetM - (prevMass - 0.5 * prevN) - 0.5 * prevN)
			prevN = prevN / 2
			if s > prevN:
				splits[-2] = int(s % prevN)
				splits[-1] = s - 2 * splits[-2]
			else:
				splits[-2] = 0
				splits[-1] = s
		ans.append(night)
		ans.append(' '.join((str(elem) for elem in splits)))
for elem in ans:
	print(elem)


T = int(input())
for _ in range(0, T):
	n = int(input())
	L = [1]
	tot = 1
	for i in range(1, 50):
		L.append(1 << i)
		tot += 1 << i
		if tot >= n:
			break
	ele1 = L[-1]
	ele2 = L[-2]
	rem = tot - n
	if rem <= ele1 // 2:
		ele1 -= rem
		L[-1] = ele1
	else:
		rem -= ele1 // 2
		ele1 -= ele1 // 2
		req = rem // 2
		if rem % 2 != 0:
			ele2 -= 1
		ele2 -= req
		ele1 -= req
		L[-1] = ele1
		L[-2] = ele2
	ans = []
	for i in range(1, len(L)):
		ans.append(L[i] - L[i - 1])
	print(len(ans))
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	a = []
	i = 1
	prd = 1
	sm = 0
	while True:
		if sm + prd > n:
			break
		sm += prd
		a.append(prd)
		prd = 2 * prd
	if sm != n:
		a.append(n - sm)
	a.sort()
	print(len(a) - 1)
	for i in range(1, len(a)):
		print(a[i] - a[i - 1], end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	k = 1
	a = []
	while (1 << k) - 1 <= n:
		a.append(1 << k - 1)
		k += 1
	if (1 << k - 1) - 1 == n:
		print(len(a) - 1)
		for i in range(1, len(a)):
			print(a[i] - a[i - 1], end=' ')
		print()
	else:
		a.append(n - (1 << k - 1) + 1)
		a.sort()
		print(len(a) - 1)
		for i in range(1, len(a)):
			print(a[i] - a[i - 1], end=' ')
		print()


import sys
input = sys.stdin.readline
from itertools import accumulate
PLUS = [1 << i for i in range(1, 31)]
SUM = list(accumulate(PLUS))
t = int(input())
for tests in range(t):
	n = int(input()) - 1
	for i in range(30):
		if SUM[i] >= n:
			ANS = i + 1
			break
	print(ANS)
	ALIST = [0] * ANS
	NOW = 1
	n -= ANS
	for i in range(ANS):
		ALIST[i] = min(n // (ANS - i), NOW)
		n -= ALIST[i] * (ANS - i)
		NOW += ALIST[i]
	print(*ALIST)


import math
from sys import stdin, stdout
from heapq import heapify, heappop, heappush
T = int(stdin.readline())
for i in range(T):
	N = int(stdin.readline())
	cn = 1
	i = 0
	i = 0
	ls = []
	while cn < N:
		N -= cn
		ls.append(cn)
		cn = pow(2, i + 1)
		i += 1
	ls.append(N)
	ls.sort()
	res = []
	r = 0
	print(len(ls) - 1)
	while r < len(ls) - 1:
		res.append(ls[r + 1] - ls[r])
		print(res[-1], end=' ')
		r += 1
	print()


from itertools import starmap
for _ in range(int(input())):
	n = int(input()) - 1
	ans = [1]
	pt = 1
	while n:
		pt = min(pt * 2, n)
		n -= pt
		ans.append(pt)
	ans.sort()
	print(len(ans) - 1)
	print(*starmap(int.__sub__, zip(ans[1:], ans)))


def bin(n, s):
	l = 0
	r = n
	while l < r:
		mid = (l + r) // 2
		if 0 <= s - 2 * mid <= n + mid:
			return [mid, s - 2 * mid]
		if s - 2 * mid > n + mid:
			l = mid + 1
		else:
			r = mid - 1
	return [l, s - 2 * l]
for _ in range(int(input())):
	m = int(input())
	n = 1
	cur = 1
	ans = []
	fl = 0
	while cur + 2 * n < m:
		ans.append(n)
		cur += 2 * n
		n *= 2
		fl = 1
	if fl:
		n //= 2
		cur -= 2 * n
		ans.pop(-1)
		ans += bin(n, m - cur - 2 * n)
	elif m == 2:
		ans = [0]
	else:
		ans = [1]
	print(len(ans))
	print(*ans)


def solve(n):
	s = 1
	x = 1
	days = [1]
	while s + 2 ** x < n:
		days.append(2 ** x)
		s += 2 ** x
		x += 1
	if s == n:
		print(x - 1)
	else:
		print(x)
		days.append(n - s)
		days.sort()
	ans = []
	for j in range(len(days) - 1):
		ans.append(days[j + 1] - days[j])
	print(' '.join(list(map(str, ans))))
t = int(input())
for i in range(t):
	n = int(input())
	solve(n)


T = int(input())
for i in range(T):
	n = int(input())
	dp = []
	num_days = 0
	Split_Pat = []
	if n <= 4:
		if n == 2:
			print(1)
			print(0)
		elif n == 3:
			print(1)
			print(1)
		else:
			print(2)
			print(0, 1)
	else:
		for i in range(1, n):
			if 2 ** i - 1 > n:
				num_days = i - 1
				extra_days = n - 2 ** num_days + 1
				break
			elif 2 ** i - 1 == n:
				extra_days = 0
				num_days = i - 1
				break
		if extra_days:
			if extra_days >= 2 ** (num_days - 1) and extra_days <= 2 ** num_days:
				for i in range(num_days - 1):
					Split_Pat.append(2 ** i)
				Split_Pat.append(extra_days - 2 ** (num_days - 1))
			else:
				for i in range(num_days - 2):
					Split_Pat.append(2 ** i)
				diff = n - (2 ** num_days - 1)
				quo = diff // 2
				rem = diff % 2
				Split_Pat.append(quo)
				Split_Pat.append(rem)
		else:
			for i in range(num_days):
				Split_Pat.append(2 ** i)
		print(num_days)
		for num in Split_Pat:
			print(num, end=' ')
		print()


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2:
		print(1)
		print(0)
	elif n == 3:
		print(1)
		print(1)
	else:
		k = 1
		m = 1
		ans = []
		for _ in range(1000):
			if m + 2 * k <= n <= m + 6 * k:
				break
			else:
				ans.append(k)
				k *= 2
				m += k
		l = -1
		r = k + 1
		while 1:
			mid = (l + r) // 2
			if m + 2 * (k + mid) <= n <= m + 3 * (k + mid):
				ans.append(mid)
				k += mid
				m += k
				ans.append(n - m - k)
				break
			elif n < m + 2 * (k + mid):
				r = mid
			elif n > m + 3 * (k + mid):
				l = mid
		print(len(ans))
		print(*ans)


import sys
from sys import stdin, stdout
from math import ceil, floor, sqrt, log, log2, log10
from collections import Counter
int_max = float('inf')
int_min = -float('inf')
mod = 10 ** 9 + 7
ANS = []
input = stdin.readline

def solve():
	pass
t = int(input())
for i in range(t):
	n = int(input())
	arr = []
	curr = 1
	summ = 0
	x = 0
	while summ < n:
		if summ + curr <= n:
			arr.append(curr)
			x += curr
		summ += curr
		curr *= 2
	if x < n:
		arr.append(n - x)
	arr.sort()
	print(len(arr) - 1)
	for i in range(1, len(arr)):
		print(arr[i] - arr[i - 1], end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	x = 1
	target = n
	a = [1]
	minn = 1
	while True:
		diff = target - x
		maxx = 2 * minn
		if minn <= diff <= maxx:
			a += [target]
			break
		elif diff >= 2 * maxx:
			minn *= 2
			x += minn
			a += [x]
		else:
			inc = diff // 2
			x += inc
			a += [x]
	current = 1
	ans = []
	for i in range(1, len(a)):
		diff = a[i] - a[i - 1]
		ans += [diff - current]
		current += diff - current
	print(len(ans))
	print(' '.join((str(k) for k in ans)))


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	n = int(data())
	answer = []
	(i, s) = (0, 0)
	while True:
		if s + pow(2, i) <= n:
			s += pow(2, i)
			answer.append(pow(2, i))
		else:
			break
		i += 1
	if n - s != 0:
		answer.append(n - s)
		answer.sort()
	out(len(answer) - 1)
	for i in range(len(answer) - 1):
		out(answer[i + 1] - answer[i], end=' ')
	out()


from collections import deque

def read_int():
	return int(input())

def read_ints():
	return map(int, input().split(' '))
t = read_int()
for case_num in range(t):
	n = read_int()
	day = 0
	num = 1
	weight = 1
	history = []
	while weight < n:
		day += 1
		delta = n - weight
		if num <= delta <= 2 * num:
			history.append(delta - num)
			weight = n
		elif delta > 2 * num:
			history.append(num)
			num *= 2
			weight += num
		else:
			history.pop()
			k = min(delta // 2, num // 2)
			p = delta - 2 * k
			history.append(k)
			history.append(p)
			weight = n
		if weight == n:
			break
	print(day)
	print(' '.join(map(str, history)))


import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import floor, ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd, log
from heapq import heappush, heappop, heapify, nlargest, nsmallest

def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def sortListWithIndex(listOfTuples, idx):
	return sorted(listOfTuples, key=lambda x: x[idx])

def sortDictWithVal(passedDic):
	temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
	toret = {}
	for tup in temp:
		toret[tup[0]] = tup[1]
	return toret

def sortDictWithKey(passedDic):
	return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
t = INT()
while t != 0:
	n = INT()
	k = floor(log(n, 2))
	temp = []
	for i in range(k + 1):
		temp.append(2 ** i - 1)
	diff = []
	for i in range(1, k + 1):
		diff.append(temp[i] - temp[i - 1])
	diff.append(n - temp[-1])
	diff.sort()
	diff1 = []
	for i in range(1, len(diff)):
		diff1.append(diff[i] - diff[i - 1])
	print(len(diff1))
	print(*diff1)
	t -= 1


from math import log
t = int(input())
for i in range(t):
	n = int(input())
	days = log(n, 2)
	days = int(days - days % 1)
	print(days)
	array = []
	previous = days + 1
	bacteria = 1
	for number in range(days):
		i = min((n - previous - (n - previous) % (days - number)) / (days - number), bacteria)
		previous += i * (days - number)
		bacteria += i
		array.append(int(i))
	for i in array:
		print(i, end=' ')


t = int(input())
for case in range(t):
	n = int(input())
	dp = [0] * 31
	dp[0] = 1
	split = []
	night = 0
	su = 1
	while su < n:
		night += 1
		best = dp[night - 1]
		if dp[night - 1] <= n - su <= dp[night - 1] * 2:
			best = n - su
		elif n - su > dp[night - 1] * 2:
			best = max(dp[night - 1], min((n - su) // 2, dp[night - 1] * 2))
		split.append(best - dp[night - 1])
		dp[night] = best
		su += dp[night]
	print(night)
	print(' '.join([str(i) for i in split]))


t = int(input(''))
for _ in range(t):
	n = int(input(''))
	arr = []
	N = n
	i = 1
	s = 0
	while s <= n:
		s += i
		if s > n:
			break
		arr.append(i)
		N -= i
		i *= 2
	if N > 0:
		arr.append(N)
		arr.sort()
	print(len(arr) - 1)
	sol = []
	for i in range(1, len(arr)):
		sol.append(arr[i] - arr[i - 1])
	print(*sol)


t = int(input())
for _ in range(t):
	n = int(input())
	days = 0
	sums = 0
	arr = []
	while sums < n:
		sums += 2 ** days
		arr += [2 ** days]
		days += 1
	days -= 1
	if sums != n:
		sums -= 2 ** days
		arr.pop()
		arr += [n - sums]
		arr.sort()
	print(days)
	for i in range(len(arr) - 1):
		print(arr[i + 1] - arr[i], end=' ')
	print()


import math
d = [1, 3]
e = [1]
for i in range(44):
	e.append(e[-1] * 2)
for i in range(36):
	d.append(d[-1] + e[i + 2])
for _ in range(int(input())):
	n = int(input())
	l = 0
	for i in range(36):
		if d[i] >= n:
			l = i
			break
	if n == d[l]:
		print(l)
		f = []
		for i in range(l):
			f.append(e[i])
		print(*f)
	else:
		l -= 1
		if n - d[l] >= e[l]:
			print(l + 1)
			f = []
			for i in range(l + 1):
				f.append(e[i])
			f[-1] -= d[l + 1] - n
			print(*f)
		else:
			print(l + 1)
			f = []
			for i in range(l + 1):
				f.append(e[i])
			f[-1] = 0
			if (d[l] + e[l] - n) % 2 == 0:
				f[-2] -= (d[l] + e[l] - n) // 2
			else:
				f[-1] = 1
				f[-2] -= (d[l] + e[l] - n + 2) // 2
			print(*f)


from collections import deque
t = int(input())
rez = []
for i in range(t):
	d = []
	n = int(input())
	j = 1
	summ = 0
	d1 = ''
	while j <= n:
		summ += j
		n -= j
		d.append(j)
		j *= 2
	if n > 0:
		d.append(n)
		d.sort()
	for j in range(1, len(d)):
		d1 += str(d[j] - d[j - 1]) + ' '
	rez.append(len(d) - 1)
	rez.append(d1)
for i in range(len(rez)):
	print(rez[i])


import math
t = int(input())
for tt in range(t):
	n = int(input())
	log = math.frexp(n)[1] - 1
	n = (1 << log + 1) - n - 1
	ans = [0] * log
	for i in reversed(range(log)):
		sub = min(n, 1 << i)
		ans[i] = (1 << i + 1) - sub
		n -= sub
	prev = 1
	for i in range(log):
		(prev, ans[i]) = (ans[i], ans[i] - prev)
	print(log)
	print(' '.join(map(str, ans)))


t = int(input())
while t:
	n = int(input())
	d = 0
	s = 0
	v = [0]
	while 1:
		temp = 1 << d
		if s + temp > n:
			d -= 1
			break
		s += temp
		d += 1
		v.append(temp)
	if s != n:
		v.append(n - s)
		d += 1
	v = sorted(v)
	print(d)
	for i in range(1, len(v) - 1):
		print(v[i + 1] - v[i], end=' ')
	print()
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = []
	i = 1
	x = 0
	while x + i <= n:
		a.append(i)
		x += i
		i *= 2
	if x != n:
		a.append(n - x)
	a = sorted(a)
	days = len(a) - 1
	print(days)
	for i in range(1, len(a)):
		the_end = ' '
		if i == days:
			the_end = '\n'
		print(a[i] - a[i - 1], end=the_end)


def solve(n):
	nights = 1
	while True:
		a = []
		rest = n - nights - 1
		cnt = 1
		for i in range(nights):
			w = nights - i
			k = min(rest // w, cnt)
			a.append(k)
			rest -= w * k
			cnt += k
		if rest == 0:
			return a
		nights += 1
	return None
tests = int(input())
for test in range(tests):
	n = int(input())
	a = solve(n)
	print(len(a))
	print(*a)


def check(n, stuff):
	totalMass = 1
	bacteria = 1
	for elem in stuff:
		bacteria += elem
		totalMass += bacteria
	print('expected:', n)
	print('got:', totalMass)
for _ in range(int(input())):
	n = int(input())
	totalMass = 1
	bacteria = 1
	ans = []
	while True:
		if totalMass + 2 * bacteria >= n:
			ans.append(n - (totalMass + bacteria))
			break
		elif totalMass + 2 * bacteria + 2 * bacteria > n:
			lo = 0
			hi = bacteria - 1
			while lo < hi:
				mid = (lo + hi + 1) // 2
				if totalMass + 2 * (bacteria + mid) > n:
					hi = mid - 1
				else:
					lo = mid
			ans.append(hi)
			bacteria += hi
		else:
			ans.append(bacteria)
			bacteria *= 2
		totalMass += bacteria
	print(len(ans))
	print(' '.join(list(map(str, ans))))


import math

def binary(n):
	l = []
	while n > 0:
		l.append(n % 2)
		n = n // 2
	return l
t = int(input())
for you in range(t):
	n = int(input())
	arr = [0 for i in range(33)]
	arr[0] = 1
	arr[1] = 3
	for i in range(2, 33):
		arr[i] = 2 * arr[i - 1] + 1
	for i in range(1, 33):
		if n > arr[i - 1] and n <= arr[i]:
			ans = i
			diff = arr[i] - n
			break
	lfi = [0 for i in range(ans)]
	for i in range(ans):
		lfi[i] = 2 ** i
	rem = diff
	for i in range(ans - 1, -1, -1):
		if rem == 0:
			break
		if lfi[i] < rem:
			rem = rem - lfi[i]
			lfi[i] = 0
			lfi[i] = rem % 2
			rem = math.ceil(rem / 2)
		else:
			lfi[i] = lfi[i] - rem
			rem = 0
	print(ans)
	for i in lfi:
		print(i, end=' ')
	print()


import sys
sys.setrecursionlimit(10000)

class Memoize:

	def __init__(self, f):
		self.f = f
		self.memo = {}

	def __call__(self, *args):
		if not args in self.memo:
			self.memo[args] = self.f(*args)
		return self.memo[args]

class Recurse(Exception):

	def __init__(self, *args, **kwargs):
		self.args = args
		self.kwargs = kwargs

def recurse(*args, **kwargs):
	raise Recurse(*args, **kwargs)

def tail_recursive(f):

	def decorated(*args, **kwargs):
		while True:
			try:
				return f(*args, **kwargs)
			except Recurse as r:
				args = r.args
				kwargs = r.kwargs
				continue
	return decorated
t = int(input())
for _ in range(t):
	n = int(input())
	weights = []
	total = 0
	for i in range(0, 32):
		p = 1 << i
		if total + p > n:
			break
		weights.append(p)
		total += p
	if total < n:
		weights.append(n - total)
	weights = sorted(weights)
	splits = list(map(lambda x: x[1] - x[0], zip(weights, weights[1:])))
	print(len(splits))
	print(' '.join(map(str, splits)))


for t in range(int(input())):
	n = int(input())
	day = 1
	current = 1
	mass = 1
	splits = []
	while mass < n:
		if mass + 4 * current <= n:
			splits.append(current)
			current *= 2
			mass += current
		else:
			y = n - mass
			if y > 2 * current:
				x1 = y // 2
				splits.append(x1 - current)
				if y % 2:
					splits.append(1)
				else:
					splits.append(0)
				break
			else:
				splits.append(y - current)
				break
	print(len(splits))
	print(*splits)


t = int(input())
for _ in range(t):
	n = int(input())
	m = 1
	cnt = 1
	ans = []
	power = 2
	while m != n:
		if n - m < 2 * power:
			if n - m <= power:
				ans.append(n - m - cnt)
				m = n
			else:
				add = (n - m) // 2
				ans.append(add - cnt)
				cnt += add - cnt
				m += cnt
				bl = add != n - m
				ans.append(int(bl))
				cnt += bl
				m += cnt
		else:
			ans.append(cnt)
			cnt *= 2
			m += cnt
		power *= 2
	print(len(ans))
	print(*ans)


from math import log, floor

def solve(n):
	size = floor(log(n, 2))
	nights = [pow(2, i) for i in range(size)]
	remaining = n - sum(nights)
	if remaining > 0:
		nights.append(remaining)
	nights.sort()
	result = []
	for i in range(1, len(nights)):
		result.append(nights[i] - nights[i - 1])
	return result
for i in range(int(input())):
	result = solve(int(input()))
	print(len(result))
	print(' '.join(map(str, result)))


from math import log
predp = [1]
while predp[-1] < 10 ** 9:
	predp.append(predp[-1] * 2)
for t in range(int(input())):
	num = int(input())
	ans1 = int(log(num + 1, 2)) - 1
	if 2 ** ans1 * 2 - 1 < num:
		ans1 += 1
	ans2 = []
	shag = ans1
	targetnow = num - shag - 1
	for i in range(ans1):
		ans2.append(min(targetnow // shag, predp[i]))
		targetnow -= min(targetnow // shag, predp[i]) * shag
		shag -= 1
	print(ans1)
	print(*ans2)


t = int(input())
for i in range(t):
	n = int(input())
	ans = []
	k = 1
	two_k = 2
	while two_k - 1 <= n // 2:
		ans.append(two_k // 2)
		k += 1
		two_k *= 2
	k -= 1
	two_k //= 2
	ans.pop()
	if n == two_k * 2 - 1:
		ans.append(two_k // 2)
	elif two_k * 2 - 2 == n:
		ans.append(two_k // 2 - 1)
	else:
		r = n - (2 * two_k - 1)
		if r == 1:
			ans.append(0)
			ans.append(1)
			k += 1
		else:
			a_1 = min(r // 2, two_k // 2)
			ans.append(a_1)
			ans.append(r - a_1 * 2)
			k += 1
	print(k)
	print(' '.join(list(map(str, ans))))


import math

def __starting_point():
	t = int(input())
	for numtests in range(t):
		n = int(input())
		d = math.floor(math.log(n, 2))
		if n == 2:
			print('1')
			print('0')
		elif n == 3:
			print('1')
			print('1')
		else:
			print(str(d))
			for i in range(d - 2):
				print(str(int(2 ** i)), end=' ')
			if n < int(3 * 2 ** (d - 1)):
				print(str(math.floor((n + 1 - 2 ** d) / 2)), end=' ')
				print(str((n + 1) % 2))
			else:
				print(str(int(2 ** (d - 2))), end=' ')
				print(str(int(n + 1 - 3 * 2 ** (d - 1))))
__starting_point()


for _ in range(int(input())):
	n = int(input()) - 1
	(ans, cur) = ([], 1)
	while n - cur * 2 >= cur * 2:
		ans.append(cur)
		n -= cur * 2
		cur *= 2
	if n == cur:
		ans.append(0)
	elif n <= cur * 2:
		ans.append(n - cur)
	elif n % 2 == 0:
		ans += [(n - 2 * cur) // 2, 0]
	else:
		res = n - cur * 2
		x = res // 2
		ans += [x, res - x * 2]
	print(len(ans))
	print(*ans)


import sys
from collections import Counter
input = sys.stdin.buffer.readline
INF = 2 ** 62 - 1

def read_int():
	return int(input())

def read_int_n():
	return list(map(int, input().split()))

def slv(N):
	ans = []
	m = 1
	b = 1
	while m < N:
		if N - m <= 2 * b:
			s = N - m - b
			ans.append(s)
			b += s
			m += b
		else:
			tb = (N - m) // 2
			s = min(tb - b, b)
			ans.append(s)
			b += s
			m += b
	print(len(ans))
	print(*ans)
	assert N == m

def main():
	T = read_int()
	for _ in range(T):
		N = read_int()
		slv(N)
main()


import math
from collections import Counter, deque
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
I = lambda : int(input())
IN = lambda : input()
mod = 10 ** 9 + 7

def s(a):
	print(' '.join(list(map(str, a))))
for _ in range(I()):
	n = I()
	a = []
	for i in range(n):
		if n >= pow(2, i):
			a.append(pow(2, i))
			n -= pow(2, i)
		else:
			break
	if n > 0:
		a.append(n)
	a.sort()
	print(len(a) - 1)
	for i in range(1, len(a)):
		print(a[i] - a[i - 1], end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	ans = []
	ai = 1
	n -= 1
	xi = 0
	while True:
		if n <= 2 * ai:
			xi = n - ai
			ai = ai + xi
			n -= ai
			ans.append(xi)
			break
		elif n <= 3 * ai:
			xi = 0
			ai = ai + xi
			n -= ai
			ans.append(xi)
		elif n < 4 * ai:
			xi = ai // 2
			ai = ai + xi
			n -= ai
			ans.append(xi)
		else:
			xi = ai
			ai = ai + xi
			n -= ai
			ans.append(xi)
	print(len(ans))
	print(' '.join(map(str, ans)))


t = int(input())

def solve(k):
	res = []
	cur = 1
	while k >= 4 * cur:
		res.append(cur)
		cur *= 2
		k -= cur
	if k <= 2 * cur:
		res.append(k - cur)
		return res
	if k <= 3 * cur:
		res.append(0)
		res.append(k - 2 * cur)
		return res
	inc = k // 3 - cur + 1
	res.append(inc)
	cur += inc
	k = k - cur
	res.append(k - cur)
	return res
for i in range(1, t + 1):
	n = int(input())
	res = solve(n - 1)
	print(len(res))
	print(' '.join((str(e) for e in res)))


t = int(input())
for _ in range(t):
	n = int(input())
	add = [1]
	power = 2
	sm = 1
	while sm + power < n:
		add.append(power)
		sm += power
		power *= 2
	add.append(n - sm)
	add.sort()
	ans = [e2 - e1 for (e1, e2) in zip(add, add[1:])]
	print(len(ans))
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	m = 1
	c = 1
	d = 0
	l = []
	while m != n:
		if 2 * c + m >= n:
			l.append(n - (m + c))
			d += 1
			break
		l.append(min(c, (n - m - 2 * c) // 2))
		c += min(c, (n - m - 2 * c) // 2)
		m += c
		d += 1
	print(d)
	print(*l)


def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))

def solve():
	n = ri()
	p = 1
	po = 0
	while p <= n:
		p *= 2
		po += 1
	print(po - 1)
	final = po - 1
	(wt, ct) = (1, 1)
	depth = 0
	while wt < n:
		if depth == final - 1:
			print(n - (ct + wt), end=' ')
			break
		if wt + ct + ct + (ct + ct) * (final - depth - 1) <= n:
			print(ct, end=' ')
			(wt, ct) = (wt + ct + ct, ct + ct)
			depth += 1
			continue
		else:
			(lo, hi) = (0, ct)
			while lo < hi - 1:
				mid = (lo + hi) // 2
				new_wt = wt + ct + mid
				new_ct = ct + mid
				min_get = new_wt + new_ct * (final - depth - 1)
				if min_get <= n:
					lo = mid
				else:
					hi = mid
			(wt, ct) = (wt + ct + lo, ct + lo)
			depth += 1
			print(lo, end=' ')
	print()
t = ri()
for i in range(t):
	solve()


from sys import stdin
from collections import defaultdict
from copy import deepcopy
import heapq
import math
from functools import reduce

def get_ans(n):
	x = n
	length = 0
	while x != 1:
		length += 1
		x = x // 2
	ans = [2 ** i for i in range(length)]
	mx_for_length = 2 ** (length + 1) - 1
	if n < mx_for_length:
		i = length - 1
		cur_num = mx_for_length
		while cur_num > n:
			cur_num -= ans[i] * (length - i)
			ans[i] = 0
			i -= 1
		i += 1
		diff = n - cur_num
		while diff != 0:
			ans[i] = diff // (length - i)
			diff = diff % (length - i)
			i += 1
	return ans
t = int(stdin.buffer.readline())
for _ in range(t):
	n = int(stdin.buffer.readline())
	ans = [str(_) for _ in get_ans(n)]
	print(len(ans))
	print(' '.join(ans))


from collections import Counter, defaultdict, deque
import heapq as hq
import math
import sys
input = sys.stdin.readline

def getx(target, cursum, curk):
	left = 0
	right = curk
	while left <= right:
		mid = (left + right) // 2
		if cursum + mid + mid + curk > target:
			right = mid - 1
		else:
			left = mid + 1
	return right

def solve():
	n = int(input())
	cur = [1, 1]
	res = []
	s = 2
	t = 0
	while cur[0] < n:
		s = sum(cur)
		x = min(cur[1], getx(n, s, cur[1]))
		if s + cur[1] >= n:
			x = n - s
		cur[1] += x
		cur[0] += cur[1]
		res.append(x)
	print(len(res))
	print(*res)
tt = int(input())
for test in range(tt):
	solve()


for _ in range(int(input())):
	n = int(input())
	ans = [1]
	sum_ans = 1
	while sum_ans + ans[-1] * 2 <= n:
		ans.append(ans[-1] * 2)
		sum_ans += ans[-1]
	if sum_ans < n:
		ans.append(n - sum_ans)
		ans.sort()
	print(len(ans) - 1)
	for i in range(1, len(ans)):
		print(ans[i] - ans[i - 1], end=' ')
	print()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	j = -1
	n = int(input())
	bit = []
	while n > 0:
		bit.append(n & 1)
		n >>= 1
	k = len(bit) - 1
	b = [1 << i for i in range(k + 1)]
	for i in range(k, 0, -1):
		if bit[i - 1] == 0:
			b[i] -= 1 << i - 1
		else:
			j = i
			break
	for i in range(1, j + 1):
		b[j] -= 1 - bit[i - 1] << i - 1
	a = [b[i + 1] - b[i] for i in range(k)]
	print(k)
	print(*a)


import sys
readline = sys.stdin.readline
for _ in range(int(input())):
	n = int(readline())
	(mass, add) = (1, 1)
	ans = []
	while mass < n:
		if mass + add * 2 >= n:
			x = n - mass - add
			ans.append(x)
			add += x
		elif mass + add * 2 + add * 2 >= n:
			ub = (n - mass) // 2
			ans.append(ub - add)
			add = ub
		else:
			ans.append(add)
			add *= 2
		mass += add
	if n == mass:
		print(len(ans))
		print(*ans)
	else:
		print(-1)


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(t,) = I()
for _ in range(t):
	(n,) = I()
	i = 1
	an = 0
	x = []
	while an + i < n:
		x.append(i)
		an += i
		i *= 2
	if n - an:
		x.append(n - an)
	x.sort()
	print(len(x) - 1)
	for i in range(1, len(x)):
		print(x[i] - x[i - 1], end=' ')
	print('')


t = int(input())
for _ in range(t):
	s = int(input())
	r = bin(s)[2:]
	p = []
	for i in range(len(r)):
		if s - 2 ** i >= 0:
			p.append(2 ** i)
			s -= 2 ** i
		else:
			break
	if s > 0:
		p.append(s)
	p.sort()
	print(len(p) - 1)
	res = []
	for i in range(1, len(p)):
		res.append(p[i] - p[i - 1])
	print(*res)


def solve():
	N = int(input())
	needed_days = N.bit_length() - 1
	print(needed_days)
	ans = [2 ** i for i in range(needed_days)]
	if N - sum(ans) != 0:
		ans.append(N - sum(ans))
	ans = sorted(ans)
	print(' '.join(map(str, [a - b for (a, b) in zip(ans[1:], ans)])))
T = int(input())
for _ in range(T):
	solve()


from sys import stdin, stdout
from collections import Counter
t = int(stdin.readline().strip())
for _ in range(t):
	n = int(stdin.readline().strip())
	tot_mass = 1
	arr = [1]
	while tot_mass < n:
		arr.append(arr[-1] << 1)
		tot_mass += arr[-1]
	arr.pop(-1)
	if n - sum(arr) > 0:
		arr.append(n - sum(arr))
	arr.sort()
	stdout.write(str(len(arr) - 1) + '\n')
	for i in range(1, len(arr)):
		stdout.write(str(arr[i] - arr[i - 1]) + ' ')
	stdout.write('\n')


from collections import defaultdict
t = int(input())
for test in range(t):
	n = int(input())
	bin_n = bin(n)[2:]
	levels = len(bin_n) - 1
	print(levels)
	red = pow(2, len(bin_n)) - 1 - n
	ans = []
	cur = 1
	for i in range(levels):
		not_dub = 0
		dub = cur
		cur_red = pow(2, levels - i) - 1
		for j in range(cur):
			if red >= cur_red:
				dub -= 1
				not_dub += 1
				red -= cur_red
			else:
				break
		ans.append(dub)
		cur = dub * 2 + not_dub
	print(*ans)


import collections
import time
import os
import sys
import bisect
import heapq
from typing import List

def solve(N):
	A = [1]
	s = 1
	while s < N:
		A.append(A[-1] * 2)
		s += A[-1]
	if s > N:
		s -= A.pop()
		bisect.insort(A, N - s)
	return '\n'.join([str(len(A) - 1), ' '.join(map(str, [b - a for (a, b) in zip(A[:-1], A[1:])]))])
T = int(input())
ans = []
for ti in range(T):
	N = int(input())
	ans.append(solve(N))
print('\n'.join(ans))


import math
for ii in range(int(input())):
	p = int(input())
	ans = [1]
	sum = 1
	while sum <= p:
		sum += 2 * ans[-1]
		ans.append(2 * ans[-1])
	sum -= ans[-1]
	ans.pop()
	diff = p - sum
	x = 0
	for i in range(len(ans) - 1):
		if ans[i] <= diff and ans[i + 1] > diff:
			x = i
			break
	if diff >= ans[-1]:
		ans.append(diff)
	elif diff == 0:
		pass
	else:
		ans = ans[0:x + 1] + [diff] + ans[x + 1:]
	result = []
	for i in range(len(ans) - 1):
		result.append(ans[i + 1] - ans[i])
	print(len(result))
	print(*result)


import sys, bisect
input = sys.stdin.buffer.readline
T = int(input())
for testcase in range(T):
	n = int(input())
	res = [1]
	tmp = 1
	while True:
		res.append(res[-1] * 2)
		tmp += res[-1]
		if tmp > n:
			break
	res.pop()
	s = sum(res)
	if s != n:
		new = n - s
		bisect.insort_left(res, new)
	ans = []
	for i in range(1, len(res)):
		ans.append(res[i] - res[i - 1])
	print(len(ans))
	print(*ans)


t = int(input())

def find_bits(n):
	temp = n
	count = 0
	while temp > 0:
		count += 1
		temp = temp // 2
	return count
for _ in range(t):
	n = int(input())
	k = find_bits(n)
	steps = k - 1
	ans = [2 ** i for i in range(k - 3)]
	if steps == 0:
		pass
	elif steps == 1:
		if n == 2:
			ans.append(0)
		else:
			ans.append(1)
	else:
		to_cover = n - (2 ** (k - 1) - 1)
		if to_cover >= 2 ** (k - 2):
			ans.append(2 ** (k - 3))
			ans.append(to_cover - 2 ** (k - 2))
		else:
			left = 2 ** (k - 3)
			right = 2 ** (k - 2)
			while True:
				x = int((left + right) / 2)
				if 2 ** (k - 2) - 1 + 2 * x <= n <= 2 ** (k - 2) - 1 + 3 * x:
					ans.append(int(x - 2 ** (k - 3)))
					ans.append(int(n - (2 ** (k - 2) - 1 + 2 * x)))
					break
				if n < 2 ** (k - 2) - 1 + 2 * x:
					right = x
				else:
					left = x
	print(steps)
	print(*ans, sep=' ')


def solve():
	a = []
	n = int(input())
	sum = 0
	i = 1
	while sum <= n:
		sum += i
		if sum > n:
			break
		a.append(i)
		i *= 2
	sum -= i
	if sum != n:
		a.append(n - sum)
	a.sort()
	print(len(a) - 1)
	for i in range(1, len(a)):
		print(a[i] - a[i - 1], end=' ')
	print()
t = int(input())
for test in range(t):
	solve()


import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
from collections import defaultdict
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default='z', func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
for ik in range(int(input())):
	n = int(input())
	ans = len(bin(n)[2:]) - 1
	print(ans)
	n -= 1
	a = 2
	l = []
	for i in range(ans - 1):
		l.append(a)
		a *= 2
	l.append(n - sum(l))
	if ans > 1 and l[-1] < l[-2]:
		t = l[-1]
		l[-1] = int(math.ceil((l[-2] + l[-1]) / 2))
		l[-2] = int(math.floor((l[-2] + t) / 2))
	print(l[0] - 1, end=' ')
	for i in range(1, ans):
		print(l[i] - l[i - 1], end=' ')
	print()


n = int(input())
for i in range(int(n)):
	a = int(input())
	for j in range(35):
		if a <= 2 ** j - 1:
			print(j - 1)
			break
	l = [2 ** x for x in range(j)]
	total = sum(l)
	c = 1
	while total != a:
		try:
			l[-c] -= min(l[-c - 1], total - a)
			total = sum(l)
			c += 1
		except:
			pass
	ans = []
	for j in range(len(l) - 1):
		ans.append(l[j + 1] - l[j])
	ans = [str(x) for x in ans]
	print(' '.join(ans))


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys
t = int(input())
for _ in range(t):
	n = int(input())
	pow2 = 1
	items = []
	while n > pow2:
		n -= pow2
		items.append(pow2)
		pow2 *= 2
	items.append(n)
	items.sort()
	sys.stdout.write(str(len(items) - 1) + '\n')
	for i in range(1, len(items)):
		sys.stdout.write(str(items[i] - items[i - 1]) + ' ')
	sys.stdout.write('\n')


for t in range(int(input())):
	n = int(input())
	i = 2
	m = 0
	p = [1]
	while n >= i:
		p.append(i)
		i *= 2
		m += 1
	print(m)
	if n >= 2 ** (m - 1) * 3 - 1:
		p[m - 1] = n - 2 ** (m - 1) * 3 + 1
		print(*p[:m])
	else:
		p[m - 2] = (n + 1) // 2 - 2 ** (m - 1)
		if n % 2 == 0:
			p[m - 1] = 1
		else:
			p[m - 1] = 0
		print(*p[:m])


t = int(input())
for test_case in range(t):
	n = int(input())
	b = 1
	ans = []
	n -= 1
	while n > 0:
		if 4 * b < n:
			ans.append(b)
			b *= 2
			n -= b
		elif 2 * b < n:
			ans.append((n - 2 * b) // 2)
			ans.append((n - 2 * b) % 2)
			n = 0
		else:
			ans.append(n - b)
			n = 0
	print(len(ans))
	print(*ans)


T = int(input())
for _ in range(T):
	n = int(input()) - 1
	out = []
	t = 1
	while n:
		if t * 2 >= n:
			out.append(n - t)
			break
		elif t * 4 >= n:
			out.append(n // 2 - t)
			out.append(n % 2)
			break
		else:
			out.append(t)
			n -= 2 * t
			t *= 2
	print(len(out))
	print(*out, sep=' ')


import sys, random
from bisect import bisect_left, bisect_right
input = sys.stdin.readline

def main():
	inf = 10 ** 20
	t = int(input())
	for _ in range(1, t + 1):
		n = int(input())
		total = 1
		plus = 1
		ans = []
		while total != n:
			if total + plus * 2 >= n:
				ans.append(n - total - plus)
				break
			else:
				(next, l, r) = (-1, plus, plus << 1)
				while l <= r:
					mid = l + r >> 1
					if total + mid * 2 > n:
						r = mid - 1
					else:
						next = max(next, mid)
						l = mid + 1
				ans.append(next - plus)
				plus = next
				total += plus
		print(len(ans))
		print(' '.join(map(str, ans)))
main()


def reproduction(time, population, weight):
	if weight < time * population:
		return -1
	weight_add = weight - time * population
	k = weight_add // time
	if k > population:
		return population
	else:
		return k
t = int(input())
for i in range(t):
	n = int(input())
	k = 0
	while 2 ** (k + 1) - 1 < n:
		k += 1
	print(k)
	population = 1
	r = k
	n -= 1
	for j in range(k):
		l = reproduction(r, population, n)
		print(l, end=' ')
		population += l
		n -= population
		r -= 1
	print()


INT_MAX = 10 ** 11 + 7
MOD = 10 ** 9 + 7

def INPUT():
	return list((int(i) for i in input().split()))

def LIST_1D_ARRAY(n):
	return [0 for _ in range(n)]

def LIST_2D_ARRAY(m, n):
	return [[0 for _ in range(n)] for _ in range(m)]
GETA = 123
import bisect

def cal(n):
	A = []
	i = 1
	while i <= n:
		A.append(i)
		n -= i
		i *= 2
	if n > 0:
		A.append(abs(n))
		A.sort()
	print(len(A) - 1)
	for i in range(1, len(A)):
		print(A[i] - A[i - 1], end=' ')
	print()
for _ in range(int(input())):
	m = int(input())
	cal(m)


T = int(input())
arr = [1]
while arr[-1] < 2 * 10 ** 9:
	arr.append(arr[-1] * 2)
for _ in range(T):
	N = int(input())
	if N == 2:
		print(1)
		print(0)
		continue
	if N == 3:
		print(1)
		print(1)
		continue
	l = len(bin(N)) - 3
	ans = arr[:l]
	rem = arr[l + 1] - 1 - N
	if ans[-1] > rem:
		ans[-1] -= rem
	else:
		rem -= ans[-1]
		if rem % 2:
			ans[-2] -= (rem + 1) // 2
			ans[-1] = 1
		else:
			ans[-2] -= rem // 2
			ans[-1] = 0
	print(len(ans))
	print(*ans)


t = int(input())
for i in range(t):
	n = int(input())
	dig = 0
	while 2 ** dig - 1 < n:
		dig += 1
	print(dig - 1)
	D = dig - 1
	num = 1
	n -= 1
	n -= D
	l = [0] * D
	for j in range(D):
		l[j] = min(num, n // (D - j))
		num += l[j]
		n -= l[j] * (D - j)
	print(*l)


t = int(input())
for _ in range(t):
	w = int(input())
	res = []
	for i in range(300):
		if 2 ** (i + 1) - 1 > w:
			break
		res.append((2 ** i, 2 ** (i + 1) - 1))
	(last_n, last_w) = res[-1]
	if last_w != w:
		if last_w + last_n <= w:
			res.append((w - last_w, w))
		else:
			res = res[:-1]
			(last_n, last_w) = res[-1]
			necc = w - last_w - 2 * last_n
			ok = False
			n = last_n
			for x in range(min(necc // 2 + 1, n // 3 + 5), -1, -1):
				y = necc - 2 * x
				if 0 <= x and x <= n and (0 <= y) and (y <= n + x):
					ok = True
					res.append((last_n + x, last_w + last_n + x))
					res.append((last_n + x + y, last_w + 2 * last_n + 2 * x + y))
					break
			if not ok:
				exit(228)
	print(len(res) - 1)
	for i in range(len(res) - 1):
		print(res[i + 1][0] - res[i][0], end=' ')
	print()


from math import log

def split(n):
	if n == 2 or n == 3:
		print(1)
		print(n - 2)
		return
	if n == 4:
		print(2)
		print(*[0, 1])
		return
	if n in (5, 6, 7):
		print(2)
		print(*[1, n - 5])
		return
	k = int(log(n, 2))
	r = n - ((1 << k) - 1)
	print(k)
	if 1 <= r <= 1 << k - 2:
		print(*[1 << i for i in range(k - 2)] + [0, r])
	elif 1 << k - 2 < r < 1 << k - 1:
		print(*[1 << i for i in range(k - 2)] + [1 << k - 3, r - (1 << k - 2)])
	else:
		print(*[1 << i for i in range(k - 2)] + [1 << k - 2, r - (1 << k - 1)])
t = int(input())
for i in range(t):
	n = int(input())
	split(n)


from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline
sqrt = math.sqrt

def LI():
	return list(map(int, input().split()))

def LF():
	return list(map(float, input().split()))

def LI_():
	return list(map(lambda x: int(x) - 1, input().split()))

def II():
	return int(input())

def IF():
	return float(input())

def S():
	return input().rstrip()

def LS():
	return S().split()

def IR(n):
	return [II() for _ in range(n)]

def LIR(n):
	return [LI() for _ in range(n)]

def FR(n):
	return [IF() for _ in range(n)]

def LFR(n):
	return [LI() for _ in range(n)]

def LIR_(n):
	return [LI_() for _ in range(n)]

def SR(n):
	return [S() for _ in range(n)]

def LSR(n):
	return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

def solve():
	for _ in range(II()):
		n = II()
		ans = []
		tmp = 1
		sumtmp = 1
		while sumtmp < n:
			if tmp + sumtmp > n:
				print(-1)
				break
			elif tmp + sumtmp == n:
				ans.append(0)
				sumtmp += tmp
			elif tmp + sumtmp < n <= 2 * tmp + sumtmp:
				ans.append(n - sumtmp - tmp)
				sumtmp = n
			elif 2 * tmp + sumtmp < n <= 3 * tmp + sumtmp:
				ans.append(0)
				sumtmp += tmp
			elif 3 * tmp + sumtmp < n < 4 * tmp + sumtmp:
				ans.append(tmp // 2)
				tmp += tmp // 2
				sumtmp += tmp
			else:
				ans.append(tmp)
				tmp *= 2
				sumtmp += tmp
		else:
			print(len(ans))
			print(*ans)
	return
solve()


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 1:
		print('0')
	elif n == 2:
		print('1')
		print('0')
	elif n == 3:
		print('1')
		print('1')
	else:
		ans = []
		cur = 1
		k = 0
		while True:
			cur *= 2
			k += 1
			if cur > n:
				break
		for i in range(0, k - 3):
			ans.append(2 ** i)
		d1 = n - 2 ** (k - 1) - 2 ** (k - 2) + 1
		d2 = n - 2 ** (k - 1) - 2 ** (k - 3) + 1
		d3 = n - 2 ** (k - 1) + 1
		if d1 >= 0:
			ans.append(2 ** (k - 3))
			ans.append(d1)
		elif d2 >= 0 and len(ans) != 0:
			ans.append(ans[-1])
			ans.append(d2)
		else:
			ans.append(0)
			ans.append(d3)
		print(len(ans))
		print(' '.join([str(i) for i in ans]))


import bisect
t = int(input())
for i in range(t):
	n = int(input())
	now = 1
	cnt = 0
	summ = 0
	ans = []
	while summ + now <= n:
		summ += now
		ans.append(now)
		now *= 2
		cnt += 1
	if summ == n:
		print(len(ans) - 1)
	else:
		bisect.insort(ans, n - summ)
		print(len(ans) - 1)
	for i in range(len(ans) - 1):
		print(ans[i + 1] - ans[i], end=' ')
	print()


from math import floor
T = int(input())
for _ in range(T):
	N = int(input())
	r = N - 1
	b = 1
	steps = []
	while r > 0:
		if b <= r <= b * 2:
			splits = r - b
			b = r
			steps += (str(splits),)
			r -= b
		else:
			splits = min(b * 2, floor(r / 2)) - b
			b += splits
			steps += (str(splits),)
			r -= b
	print(len(steps))
	print(' '.join(steps))


import sys
input = sys.stdin.buffer.readline
from collections import defaultdict
con = 10 ** 9 + 7

def getlist():
	return list(map(int, input().split()))

def main():
	T = int(input())
	for i in range(T):
		N = int(input())
		div = []
		var = 0
		while True:
			x = 2 ** var
			if x <= N:
				div.append(x)
				var += 1
				N -= x
			else:
				if N != 0:
					div.append(N)
				break
		div = sorted(div)
		ans = len(div) - 1
		ansL = [0] * ans
		for j in range(ans):
			if div[j] != div[j + 1]:
				ansL[j] = div[j + 1] - div[j]
		print(ans)
		print(' '.join(list(map(str, ansL))))
main()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	tmass = 1
	nbac = 1
	d = 0
	s = []
	n = int(input())
	if n > 1:
		while tmass < n:
			s.append(nbac)
			nbac *= 2
			tmass += nbac
			d += 1
		dm = tmass - n
		if dm != 0:
			while dm > 2 ** (len(s) - 1):
				if s[-2] == 1:
					s[-2] = 0
					dm -= 2
				else:
					s[-2] = int(s[-2] / 2)
					dm -= 2 * s[-2]
			s[-1] = s[-1] - dm
		print(d)
		print(' '.join(map(str, s)))
	else:
		print(-1)


import os
import sys
from io import BytesIO, IOBase
from bisect import bisect_left

def main():
	z = 10 ** 9
	arr = [1]
	pre = [1]
	while True:
		zz = arr[-1] << 1
		pre.append(pre[-1] + zz)
		if pre[-1] <= z:
			arr.append(zz)
		else:
			break
	for _ in range(int(input())):
		n = int(input())
		z = bisect_left(pre, n)
		ans = []
		if pre[z] == n:
			for i in range(1, z + 1):
				ans.append(arr[i] - arr[i - 1])
		elif arr[z - 1] + pre[z - 1] > n:
			x = (n - pre[z - 2] >> 1) - arr[z - 2]
			for i in range(1, z - 1):
				ans.append(arr[i] - arr[i - 1])
			ans.append(x)
			ans.append((n - pre[z - 2]) % 2)
		else:
			x = n - pre[z - 1] - arr[z - 1]
			for i in range(1, z):
				ans.append(arr[i] - arr[i - 1])
			ans.append(x)
		print(len(ans))
		print(*ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = pow(10, 9) + 7

def inp():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def solve():
	n = int(inp())
	temp = n
	i = 0
	arr = []
	while 2 ** i <= temp:
		temp -= 2 ** i
		arr.append(2 ** i)
		i += 1
	if temp > 0:
		arr.append(temp)
		arr = sorted(arr)
	out(len(arr) - 1)
	nextline()
	for i in range(1, len(arr)):
		out(arr[i] - arr[i - 1])
		out(' ')
	nextline()
testcase(int(inp()))


from sys import stdin, stdout
import math

def main():
	t = int(stdin.readline())
	for _ in range(t):
		n = int(stdin.readline())
		if n == 2:
			stdout.write('1\n0\n')
			continue
		m = 1
		c = 1
		arr = []
		while True:
			arr.append(m)
			m *= 2
			c += m
			if c == n:
				break
			elif c + m > n:
				re = (n - c + m) / 2
				arr[-1] = math.floor(re) - int(m / 2)
				arr.append(math.ceil(re) - int(m / 2) - arr[-1])
				break
			elif c + 2 * m > n:
				arr.append(n - c - int(m))
				break
		stdout.write(str(len(arr)) + '\n')
		stdout.write(' '.join((str(x) for x in arr)) + '\n')
main()


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def main():
	for _ in range(II()):
		n = II()
		s = 1
		d = 2
		dd = [1]
		while n - s >= d * 2:
			dd.append(d)
			s += d
			d *= 2
		if n - s <= d:
			dd.append(n - s)
		else:
			r = n - s
			if r % 2:
				dd += [r // 2, r // 2 + 1]
			else:
				dd += [r // 2, r // 2]
		ans = []
		for i in range(len(dd) - 1):
			ans.append(dd[i + 1] - dd[i])
		print(len(ans))
		print(*ans)
main()


import math

def process_test_case(i_test):
	n = int(input())
	n_days = math.floor(math.log2(n))
	out_list = []
	n_threshold = int(pow(2, n_days) + pow(2, n_days - 1) - 1)
	if n >= n_threshold:
		for i in range(n_days - 1):
			out_list.append(str(int(pow(2, i))))
		out_list.append(str(int(n - n_threshold)))
	else:
		for i in range(n_days - 2):
			out_list.append(str(int(pow(2, i))))
		n_reminder = n - pow(2, n_days) + 1
		a = n_reminder // 2
		b = n_reminder - 2 * a
		out_list.append(str(a))
		out_list.append(str(b))
	print(int(n_days))
	print(' '.join(out_list))
n_tests = int(input())
for i_test in range(1, n_tests + 1):
	process_test_case(i_test)


import math

def find(n):
	ct = 0
	while n > 0:
		n //= 2
		ct += 1
	return ct
arr = [1] * 32
for i in range(1, 32):
	arr[i] = 2 * arr[i - 1]
for t in range(int(input())):
	ans = [1]
	n = int(input())
	if n == 2:
		ans.append(1)
	elif n == 3:
		ans.append(2)
	else:
		sum = 0
		target = n - 1
		length = find(n)
		for i in range(1, length - 2):
			sum += arr[i]
			ans.append(arr[i])
		required = target - sum
		no1 = max(ans[-1], math.ceil(required / 3))
		no2 = required - no1
		ans.append(no1)
		ans.append(no2)
	print(len(ans) - 1)
	for i in range(1, len(ans)):
		print(ans[i] - ans[i - 1], end=' ')
	print()


a = int(input())
for i in range(a):
	s = int(input())
	q = s + 1
	cnt = 0
	while pow(2, cnt) < q:
		cnt += 1
	cnt -= 1
	ans = [0 for i in range(cnt)]
	value = s
	for i in range(len(ans)):
		if i == 0:
			particles = 1
		else:
			particles += ans[i - 1]
		if i == 0:
			cost = len(ans) + 1
			if cost + len(ans) <= value:
				ans[i] = 1
				cost += len(ans)
				continue
			else:
				ans[i] = 0
				continue
		remn = value - cost
		g1 = remn // (len(ans) - i)
		r1 = min(g1, particles)
		cost += r1 * (len(ans) - i)
		ans[i] = r1
	print(len(ans))
	print(*ans)


import math
nrew = int(input())
for wew in range(nrew):
	n = int(input()) + 1
	p = int(math.ceil(math.log(n, 2)) - 1)
	print(p)
	ans = []
	n -= p + 2
	for i in range(p):
		tr = int(n / (p - i))
		er = pow(2, i)
		if tr <= er:
			ans.append(tr)
			n -= tr * (p - i)
		else:
			ans.append(er)
			n -= er * (p - i)
	while len(ans) != p:
		ans.append(0)
	for qw in ans:
		print(qw, end=' ')
	print('')


n_cases = int(input())
for case_num in range(n_cases):
	n = int(input()) - 1
	k = 1
	days = []
	while n > 0:
		if n >= 4 * k:
			days.append(k)
			k *= 2
			n -= k
		elif n <= 2 * k:
			days.append(n - k)
			k += n - k
			n -= k
			break
		else:
			n -= 2 * k
			assert n > 0
			d = n // 2
			days.append(d)
			n -= 2 * d
			assert n <= k + d
			days.append(n)
			break
	print(len(days))
	print(' '.join([str(x) for x in days]))


massas = list()
repeticoes = int(input())
for i in range(repeticoes):
	massas.append(int(input()))
for massa_final in massas:
	atual = [1, [1]]
	while atual:
		if atual[0] == massa_final:
			break
		massa = atual[0]
		bacterias = atual[1][-1]
		if massa + 4 * bacterias <= massa_final:
			atual[0] += 2 * bacterias
			atual[1].append(2 * bacterias)
		else:
			valor = massa_final - massa
			if valor // bacterias == 1:
				atual[1].append(bacterias + valor % bacterias)
				atual[0] += atual[1][-1]
			elif valor // bacterias == 2:
				if valor % bacterias == 0:
					atual[0] = massa_final
					atual[1].append(2 * bacterias)
				else:
					atual[1].append(bacterias)
					atual[0] += atual[1][-1]
					atual[1].append(bacterias + valor % bacterias)
					atual[0] += atual[1][-1]
			elif valor // bacterias == 3:
				n = bacterias - valor % bacterias
				if n % 2 == 0:
					atual[1].append(2 * bacterias - n // 2)
					atual[1].append(2 * bacterias - n // 2)
					atual[0] = massa_final
				else:
					atual[1].append(2 * bacterias - (n + 1) // 2)
					atual[1].append(2 * bacterias - (n - 1) // 2)
					atual[0] = massa_final
	for i in range(len(atual[1]) - 1, 0, -1):
		atual[1][i] -= atual[1][i - 1]
	print(len(atual[1]) - 1)
	print(*atual[1][1:])


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')

def main():
	for _ in range(N()):
		n = N()
		res = []
		i = 0
		while 1 << i <= n:
			now = 1 << i
			res.append(now)
			n -= now
			i += 1
		if n != 0:
			res.append(n)
		res.sort()
		print(len(res) - 1)
		for i in range(1, len(res)):
			print(res[i] - res[i - 1], end=' ')
		print()
main()


def inp():
	return int(input())
import math

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
import bisect

def solve(N):
	lo = 1
	high = 30
	while lo < high:
		mid = (lo + high) // 2
		value1 = 1 + mid
		value2 = 2 ** value1 - 1
		if N >= value1 and N <= value2:
			high = mid
		elif N < value1:
			high = mid - 1
		elif N > value2:
			lo = mid + 1
	current_sum = 2 ** lo - 1
	li = []
	for i in range(lo):
		li.append(2 ** i)
	remaining = N - current_sum
	final_one = None
	if remaining >= 2 ** (lo - 1):
		final_one = remaining
		li.append(final_one)
	else:
		last_one = li[-1]
		shift = math.ceil((last_one - remaining) / 2)
		li[-1] -= shift
		final_one = remaining + shift
		li.append(final_one)
	li.pop(0)
	count = 1
	for i in range(1, lo + 1):
		original = li[i - 1]
		li[i - 1] = li[i - 1] - count
		count = original
	return (lo, li)
test_cases = inp()
for i in range(test_cases):
	N = inp()
	(lo, li) = solve(N)
	print(lo)
	for i in range(len(li)):
		if i == len(li) - 1:
			print(li[i])
		else:
			print(li[i], end=' ')


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree:

	def __init__(self, data, default=-10 ** 6, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree1:

	def __init__(self, data, default=10 ** 6, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
MOD = 10 ** 9 + 7

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
mod = 10 ** 9 + 7
omod = 998244353
prime = [True for i in range(200001)]
pp = [0] * 200001

def SieveOfEratosthenes(n=200000):
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
for u in range(int(input())):
	n = int(input())
	l = []
	i = 1
	while i < n + 1:
		l.append(i)
		n = n - i
		i = i * 2
	if n > 0:
		l.append(n)
		l.sort()
	print(len(l) - 1)
	for i in range(1, len(l)):
		print(l[i] - l[i - 1], end=' ')
	print()


from __future__ import division, print_function
import sys
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	n = int(input())
	res = []
	i = 0
	while 1 << i < n:
		n -= 1 << i
		res.append(1 << i)
		i += 1
	if n > 0:
		res.append(n)
	res.sort()
	for i in range(len(res) - 1):
		res[i] = res[i + 1] - res[i]
	res.pop()
	print(len(res))
	print(*res)


from bisect import bisect
p0 = [2 ** i for i in range(32)]
p1 = [v - 1 for v in p0]

def solve(n):
	k = bisect(p1, n - 1) - 1
	(x, y) = (p1[k], p1[k + 1] - p0[k - 1])
	if n < y:
		t = n - x
		r = p0[:k - 2]
		r.append(t // 2)
		r.append(t % 2)
	else:
		r = p0[:k - 1]
		r.append(n - y)
	return (k, r)
for _ in range(int(input())):
	(k, p) = solve(int(input()))
	print(k)
	print(*p)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	m = math.ceil(math.log2(n + 1)) - 1
	print(m)
	if m == 1:
		print(n - 2)
	else:
		a = []
		for i in range(m + 1):
			if i <= m - 2:
				a.append(2 ** i)
			elif i == m - 1:
				a.append(max(math.ceil((n - 2 ** (m - 1) + 1) / 3), 2 ** (m - 2)))
			else:
				a.append(n - 2 ** (m - 1) + 1 - a[m - 1])
		res = []
		for i in range(1, m + 1):
			res.append(a[i] - a[i - 1])
		print(' '.join(map(str, res)))


from math import log2

def solve(M):
	if M == 2:
		return [0]
	p = int(log2(M))
	_m = 2 ** p - 1
	_n = 2 ** (p - 1)
	if M >= _m + _n:
		res = [2 ** i for i in range(p - 1)] + [M - _m - _n]
	else:
		p -= 1
		_m = 2 ** p - 1
		_n = 2 ** (p - 1)
		_n1 = M - _m - 1 >> 1 if (M - _m) % 2 == 1 else M - _m >> 1
		res = [2 ** i for i in range(p - 1)] + [_n1 - _n, M - _m - _n1 - _n1]
	return res
T = int(input())
for _ in range(T):
	M = int(input())
	res = solve(M)
	print(len(res))
	print(' '.join(map(str, res)))


t = int(input())
for _ in range(t):
	n = int(input())
	m = 1
	c = 1
	ss = []
	while True:
		if n <= m + 2 * c:
			ss.append(str(n - m - c))
			break
		elif n < m + 4 * c:
			nc = (n - m) // 2
			ss.append(str(nc - c))
			c = nc
			m += c
		else:
			ss.append(str(c))
			c *= 2
			m += c
	print(len(ss))
	print(' '.join(ss))


for _ in range(int(input())):
	n = int(input())
	remain = n
	arr = []
	cur = 1
	while remain > 0:
		if remain < cur:
			arr.append(remain)
			remain = 0
		else:
			arr.append(cur)
			remain -= cur
			cur *= 2
	if len(arr) >= 2 and arr[-2] > arr[-1]:
		add = min(arr[-2] // 2, arr[-2] - arr[-1])
		arr[-2] -= add
		arr[-1] += add
	ans = ' '.join([str(x - y) for (x, y) in zip(arr[1:], arr[:-1])])
	print(len(arr) - 1)
	print(ans)


for t in range(int(input())):
	n = int(input())
	(b, d) = (1, n - 1)
	ans = []
	while d > 0:
		if d <= b * 2:
			db = d - b
		else:
			db = min(b, d // 2 - b)
		ans.append(db)
		b += db
		d -= b
	print(len(ans))
	for x in ans:
		print(x, end=' ')
	print()


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def solve():
	n = int(input())
	cur = 1
	n -= cur
	a = [cur]
	for i in range(100):
		if n == 0:
			break
		elif n >= 2 * cur:
			cur *= 2
			a.append(cur)
			n -= cur
		else:
			a.append(n)
			n = 0
	a.sort()
	b = [a[i + 1] - a[i] for i in range(len(a) - 1)]
	print(len(b))
	print(*b)
t = int(input())
for i in range(t):
	solve()


for _ in range(int(input())):
	n = int(input()) - 1
	answer = []
	cur = 1
	while n - cur * 2 >= cur * 2:
		answer.append(cur)
		n -= cur * 2
		cur *= 2
	if n == cur:
		answer.append(0)
	elif n <= cur * 2:
		answer.append(n - cur)
	elif n % 2 == 0:
		answer += [(n - 2 * cur) // 2, 0]
	else:
		ost = n - cur * 2
		x = ost // 2
		answer += [x, ost - x * 2]
	print(len(answer))
	print(*answer)


t = int(input())
import math
for _ in range(t):
	n = int(input())
	keta = math.floor(math.log2(n))
	a = [0] * keta
	if keta >= 2:
		for i in range(keta):
			a[i] = 2 ** i
		sa = n - (2 ** keta - 1)
		a[keta - 2] = min(sa // 2, a[keta - 2])
		a[keta - 1] = sa - a[keta - 2] * 2
	elif n == 2:
		a[0] = 0
	else:
		a[0] = 1
	print(keta)
	print(*a)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	l = [1]
	s = 1
	for i in range(1, 35):
		if s + 2 ** i > n:
			break
		l.append(2 ** i)
		s += 2 ** i
	if s < n:
		l.append(n - s)
		l.sort()
	ans = []
	for i in range(len(l) - 1):
		ans.append(l[i + 1] - l[i])
	print(len(ans))
	print(*ans)


def log(n: int) -> int:
	ans = -1
	while n:
		ans += 1
		n >>= 1
	return ans
for _ in range(int(input())):
	n = int(input())
	a = [1]
	b = 2
	s = 1
	while b <= n - s:
		a.append(b)
		s += b
		b <<= 1
	if n - s:
		a.append(n - s)
	if a[-2] > a[-1]:
		z = a[-2] + a[-1]
		a[-2] = z // 2
		a[-1] = z - z // 2
	m = log(n) + 1
	c = []
	for i in range(1, m):
		c.append(a[i] - a[i - 1])
	print(m - 1)
	print(*c)


import sys
import math

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]
t = int(input())
for q in range(t):
	n = inputnum()
	l = []
	mass = 0
	add = 1
	while mass < n:
		l.append(add)
		mass += add
		add *= 2
	if mass > n:
		l[len(l) - 1] = n - (mass - l[len(l) - 1])
	l.sort()
	print(len(l) - 1)
	for i in range(1, len(l)):
		print(l[i] - l[i - 1], end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	i = 1
	l = [1]
	suma = 1
	while suma < n:
		l.append(min(n - suma, l[-1] * 2))
		suma += l[-1]
	l.sort()
	print(len(l) - 1)
	for j in range(1, len(l)):
		print(l[j] - l[j - 1], end=' ')
	print()


import sys
input = sys.stdin.readline
Q = int(input())
Query = [int(input()) for _ in range(Q)]
for N in Query:
	L = N.bit_length() - 1
	ans = []
	if L == 1:
		ans = [N % 2]
	else:
		for l in range(L - 2):
			ans.append(2 ** l)
		if 3 * 2 ** (L - 1) - 1 <= N:
			ans.append(2 ** (L - 2))
			ans.append(N - 3 * 2 ** (L - 1) + 1)
		else:
			d = N - 2 ** L + 1
			ans.append(d // 2)
			ans.append(d % 2)
	print(L)
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	ans = []
	prev = 1
	m = 1
	while m != n:
		if n - m >= 4 * prev:
			curr = 2 * prev
		elif prev <= n - m and n - m <= 2 * prev:
			curr = n - m
		else:
			curr = (n - m) // 2
		m += curr
		ans.append(str(curr - prev))
		prev = curr
	print(len(ans))
	print(' '.join(ans))


from sys import stdin
for case in range(int(stdin.readline())):
	n = int(stdin.readline())
	c = 1
	bruh = 1
	nights = 0
	mult = []
	while c < n:
		nights += 1
		mult.append(bruh)
		c *= 2
		c += 1
		bruh *= 2
	diff = c - n
	if diff != 0:
		for ind in range(len(mult) - 1, -1, -1):
			x = mult[ind]
			times = len(mult) - ind
			if x * times <= diff:
				diff -= x * times
				mult[ind] = 0
			else:
				mult[ind] -= diff // times
				diff -= diff // times * times
				if diff > 0:
					mult[ind] -= 1
					diff -= times
				break
	if diff != 0:
		mult[diff] += 1
	print(len(mult))
	print(' '.join([str(x) for x in mult]))


import os
import sys
from io import BytesIO, IOBase

def iin():
	return int(input())

def lin():
	return list(map(int, input().split()))

def main():
	T = iin()
	for _ in range(T):
		n = iin()
		df = n - 1
		ans = [1]
		ch = 1
		while df:
			if df == ans[-1]:
				ans.append(df)
				df = 0
			elif df < ans[-1]:
				print(-1)
				break
			else:
				x = 1 << ch
				if df == x:
					ans.append(x)
					df -= x
				elif df < x:
					ans.append(df)
					df -= df
				else:
					lf = df - x
					if lf < x:
						ans.append(df // 2)
						df -= df // 2
					else:
						ans.append(x)
						df -= x
			ch += 1
		else:
			l = len(ans)
			sol = []
			for i in range(1, l):
				sol.append(ans[i] - ans[i - 1])
			print(len(sol))
			print(*sol)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for case in range(t):
	n = int(input())
	i = 1
	l = [1]
	while sum(l) <= n:
		i *= 2
		l.append(i)
	if sum(l) > n:
		l.pop()
	if sum(l) != n:
		l.append(n - sum(l))
	l = sorted(l)
	print(len(l) - 1)
	for i in range(len(l) - 1):
		print(l[i + 1] - l[i], end=' ')
	print()


def solve():
	res = []
	target = int(input()) - 1
	n = 1
	while n * 2 * 2 <= target:
		res.append(n)
		n *= 2
		target -= n
	if target <= n * 2:
		res.append(target - n)
	else:
		res.append(target // 2 - n)
		res.append(1 if target & 1 else 0)
	print(len(res))
	print(' '.join(map(str, res)))
for _ in range(int(input())):
	solve()


for i in range(int(input())):
	n = int(input())
	aa = []
	x = 0
	su = 0
	while su <= n:
		aa.append(2 ** x)
		su += 2 ** x
		x += 1
	if su > n:
		p = aa.pop()
		su -= p
	if su != n:
		aa.append(n - su)
	aa.sort()
	pp = []
	for i in range(len(aa) - 1):
		pp.append(aa[i + 1] - aa[i])
	print(len(pp))
	print(*pp)


import io
import os

def solve(N):
	nums = [1]
	total = 1
	while total + 2 * nums[-1] <= N:
		nums.append(2 * nums[-1])
		total += nums[-1]
	assert total <= N
	if total != N:
		nums.append(N - total)
		nums.sort()
	ans = [y - x for (x, y) in zip(nums, nums[1:])]
	return str(len(ans)) + '\n' + ' '.join(map(str, ans))
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(N,) = [int(x) for x in input().split()]
	ans = solve(N)
	print(ans)


def op(list):
	listn = []
	for i in range(len(list) - 1):
		listn.append(list[i + 1] - list[i])
	listToStr = ' '.join([str(elem) for elem in listn])
	return listToStr

def f(n):
	return 2 ** n - 1
n = int(input())
for i in range(n):
	x = int(input())
	c = 0
	alist = []
	while f(c) < x:
		c += 1
		alist.append(2 ** (c - 1))
	print(c - 1)
	if x == f(c):
		print(op(alist))
	else:
		alist.pop()
		value = x - f(c - 1)
		alist.append(value)
		alist.sort()
		print(op(alist))


t = int(input())
for _ in range(0, t):
	n = int(input())
	arr = []
	i = 1
	while i <= n:
		arr.append(i)
		n -= i
		i *= 2
	if n:
		arr.append(n)
		arr = sorted(arr)
	print(len(arr) - 1)
	ans = []
	for i in range(1, len(arr)):
		ans.append(arr[i] - arr[i - 1])
	print(*ans)


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	N = INT()
	C = []
	k = 0
	sm = 0
	while sm + 2 ** k <= N:
		sm += 2 ** k
		C.append(2 ** k)
		k += 1
	if sm < N:
		C.append(N - sm)
		C.sort()
	ans = []
	for i in range(len(C) - 1):
		ans.append(C[i + 1] - C[i])
	print(len(ans))
	print(*ans)


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip().split()]

def st():
	return str(input().rstrip())[2:-1]

def val():
	return int(input().rstrip())

def li2():
	return [str(i)[2:-1] for i in input().rstrip().split()]

def li3():
	return [int(i) for i in input().rstrip()]
for _ in range(val()):
	d = val()
	temp = d
	hlp = 0
	while temp:
		temp //= 2
		hlp += 1
	print(hlp - 1)
	arr = []
	temp2 = 0
	b = [2 ** i for i in range(hlp - 1)]
	su = sum(b)
	if su < d:
		b.append(d - su)
	b.sort()
	ans = []
	for i in range(hlp - 1):
		if b[i] == b[i + 1]:
			ans.append(0)
		else:
			ans.append(b[i + 1] - b[i])
	print(*ans)


from math import log2

def insertInArr(arr, x):
	for i in range(len(arr)):
		if arr[i] >= x:
			arr.insert(i, x)
			return
	arr.append(x)
for _ in range(int(input())):
	n = int(input())
	arr = []
	x = 1
	for i in range(int(log2(n + 1))):
		arr.append(x)
		x *= 2
	if 2 * arr[-1] - 1 != n:
		insertInArr(arr, n - 2 * arr[-1] + 1)
	print(len(arr) - 1)
	for i in range(1, len(arr)):
		print(arr[i] - arr[i - 1], end=' ')
	print()


p = [1]
for i in range(1, 32):
	p.append(p[-1] * 2)

def lg2(x):
	if x == 0:
		return -1
	global p
	res = 0
	if x >= p[16]:
		x >>= 16
		res += 16
	if x >= p[8]:
		x >>= 8
		res += 8
	if x >= p[4]:
		x >>= 4
		res += 4
	if x >= p[2]:
		x >>= 2
		res += 2
	if x >= p[1]:
		x >>= 1
		res += 1
	return res
t = int(input())
for _ in range(t):
	n = int(input())
	d = lg2(n)
	print(d)
	dd = p[0:d]
	r = p[d + 1] - n - 1
	while r > 0:
		k = lg2(r + 1)
		r -= p[k] - 1
		dd[d - k] -= 1
		for i in range(k - 1):
			dd[d - k + i + 1] -= p[i]
	print(' '.join([str(x) for x in dd]))


import bisect
for _ in range(int(input())):
	n = int(input())
	growth = []
	s = 0
	i = 1
	while s <= n:
		if s + i > n:
			break
		growth.append(i)
		s += i
		i *= 2
	if n != s:
		bisect.insort(growth, n - s)
	print(len(growth) - 1)
	print(*[growth[i] - growth[i - 1] for i in range(1, len(growth))])


from math import *
from collections import *
test = int(input())
for y in range(test):
	n = int(input())
	n -= 1
	i = 1
	ans = []
	while n > 0:
		if i * 4 < n:
			ans.append(i)
			i *= 2
		elif i * 3 <= n <= i * 4:
			ans.append(n - i * 3)
			i += n - i * 3
		elif n > i * 2:
			ans.append(0)
		else:
			ans.append(n - i)
			i += n - i
		n -= i
	print(len(ans))
	for i in ans:
		print(i, end=' ')
	print()


T = int(input())
for case in range(T):
	n = int(input())
	o = 0
	arr = []
	while 2 ** o - 1 < n:
		arr.append(2 ** o)
		o += 1
	diff = 2 ** o - 1 - n
	b = str(bin(diff))[2:][::-1]
	o2 = 0
	arr2 = []
	while o2 < len(b):
		if b[o2] == '0':
			pass
		else:
			arr2.append(2 ** o2)
		o2 += 1
	delta = len(arr) - len(arr2)
	for i in range(delta, len(arr2) + delta):
		arr[i] -= arr2[i - delta]
	ret = []
	for i in range(len(arr) - 1):
		ret.append(str(arr[i + 1] - arr[i]))
	days = len(ret)
	ret = ' '.join(ret)
	print(days)
	print(ret)


T = int(input())
for t in range(T):
	n = int(input())
	s = 1
	nxt = 2
	x = [1]
	while n > s:
		diff = n - s
		if diff <= nxt:
			x.append(diff)
			break
		x.append(nxt)
		s += nxt
		nxt *= 2
	x.sort()
	ans = ''
	for i in range(len(x) - 1):
		v = x[i + 1] - x[i]
		ans += str(v) + ' '
	print(len(x) - 1)
	print(ans[:-1])


import sys
from array import array
import typing as Tp

def input():
	return sys.stdin.buffer.readline().decode('utf-8')

def output(*args):
	sys.stdout.buffer.write(('\n'.join(map(str, args)) + '\n').encode('utf-8'))

def main():
	t = int(input())
	ans_a = [''] * t
	for ti in range(t):
		n = int(input())
		(mass, growth) = (1, 1)
		ans = []
		while mass < n:
			if mass + growth * 2 < n and n < mass + growth * 4:
				new_growth = n - mass >> 1
				ans.append(new_growth - growth)
				growth = new_growth
			elif mass + growth * 2 <= n:
				ans.append(growth)
				growth *= 2
			else:
				ans.append(n - mass - growth)
				growth += ans[-1]
			mass += growth
		assert mass == n
		ans_a[ti] = f"{len(ans)}\n{' '.join(map(str, ans))}"
	output(*ans_a)
main()


def days(goal):
	for d in range(30 + 1):
		if 1 << d > goal:
			return d - 1

def solve(c, s, d, ans):
	s -= c
	ans.append(c)
	if d == 0:
		assert s == 0
		return
	solve(min(2 * c, s // d), s, d - 1, ans)
for _ in range(int(input())):
	goal = int(input())
	ans = []
	solve(1, goal, days(goal), ans)
	d = len(ans) - 1
	print(d)
	print(*[ans[i + 1] - ans[i] for i in range(d)])


for _ in range(int(input())):
	n = int(input())
	d = n.bit_length()
	print(d - 1)
	res = [2 ** i for i in range(d)]
	res[-1] = n - sum((res[i] for i in range(d - 1)))
	res.sort()
	ans = [res[i + 1] - res[i] for i in range(d - 1)]
	print(*ans)


from sys import stdin
from collections import Counter
T = int(input())
for _ in range(T):
	n = int(input())
	(cc, sm) = ([], 0)
	for i in range(40):
		b = 1 << i
		if sm + b <= n:
			sm += b
			cc.append(b)
		else:
			if n - sm > 0:
				cc.append(n - sm)
			break
	cc.sort()
	res = [cc[i] - cc[i - 1] for i in range(1, len(cc))]
	print(len(res))
	print(*res)


t = int(input())
for _ in range(t):
	n = int(input())
	(b, m) = (1, 1)
	res = []
	while True:
		if 2 * b + m >= n:
			res.append(n - (m + b))
			break
		add = min(b, (n - (2 * b + m)) // 2)
		res.append(add)
		b += add
		m += b
	d = len(res)
	print(d)
	print(' '.join((str(a) for a in res)))


import sys
input = sys.stdin.readline

def bs(num):
	low = num
	high = 2 * num
	while low < high:
		mid = (low + high) // 2
		if mass + 2 * mid > n:
			high = mid - 1
		else:
			low = mid + 1
	if mass + 2 * low > n:
		return low - 1
	else:
		return low
for nt in range(int(input())):
	n = int(input())
	bac = 1
	mass = 1
	ans = []
	while mass != n:
		if n - mass >= bac and n - mass <= 2 * bac:
			ans.append(n - mass - bac)
			break
		m = bs(bac)
		ans.append(m - bac)
		bac = m
		mass += m
	print(len(ans))
	print(*ans)