Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1.

You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n - 1 slimes one by one. When you add a slime, you place it at the right of all already placed slimes. Then, while the last two slimes in the row have the same value v, you combine them together to create a slime with value v + 1.

You would like to see what the final state of the row is after you've added all n slimes. Please print the values of the slimes in the row from left to right.


-----Input-----

The first line of the input will contain a single integer, n (1 ≤ n ≤ 100 000).


-----Output-----

Output a single line with k integers, where k is the number of slimes in the row after you've finished the procedure described in the problem statement. The i-th of these numbers should be the value of the i-th slime from the left.


-----Examples-----
Input
1

Output
1

Input
2

Output
2

Input
3

Output
2 1

Input
8

Output
4



-----Note-----

In the first sample, we only have a single slime with value 1. The final state of the board is just a single slime with value 1.

In the second sample, we perform the following steps:

Initially we place a single slime in a row by itself. Thus, row is initially 1.

Then, we will add another slime. The row is now 1 1. Since two rightmost slimes have the same values, we should replace these slimes with one with value 2. Thus, the final state of the board is 2.

In the third sample, after adding the first two slimes, our row is 2. After adding one more slime, the row becomes 2 1.

In the last sample, the steps look as follows:   1  2  2 1  3  3 1  3 2  3 2 1  4

Source: codeforces | Difficulty: EASY
Tags: Implementation


Solutions:
n = int(input())
l = [1]
for i in range(2, n + 1):
	l.append(1)
	while l[-1] == l[-2]:
		p = l.pop()
		l.pop()
		l.append(p + 1)
		if len(l) == 1:
			break
for i in l:
	print(i, end=' ')


n = int(input())
arr = []
for _ in range(n):
	arr.append(1)
	while len(arr) >= 2 and arr[-1] == arr[-2]:
		t = arr[-1] + 1
		del arr[-1]
		del arr[-1]
		arr.append(t)
print(*arr)


n = bin(int(input()))
answer = list()
for i in range(2, len(n)):
	if n[-i + 1] == '1':
		answer.append(i - 1)
print(' '.join((str(x) for x in reversed(answer))))


x = int(input())
i = 0
a = []
while x:
	i = i + 1
	if x % 2 != 0:
		b = x % 2 * i
		a.append(b)
		x = x // 2
	else:
		x = x // 2
a.reverse()
for t in range(len(a)):
	print('{}'.format(a[t]))


n = int(input())
l = []
for i in range(n):
	l.append(1)
	while len(l) > 1 and l[-1] == l[-2]:
		l.pop()
		l[-1] += 1
print(*l)


import time
n = int(input())
start = time.time()
ans = []
while n > 1:
	k = 1
	t = 0
	while k <= n:
		k *= 2
		t += 1
	k //= 2
	ans.append(t)
	n -= k
for i in ans:
	print(i, end=' ')
if n == 1:
	print(1)
else:
	print()
finish = time.time()


n = int(input())
arr = [0] * n
i = 1
for i in range(n):
	arr[i] = n % 2
	n //= 2
for j in range(i, -1, -1):
	if arr[j] != 0:
		print(j + 1, end=' ')


n = int(input())
ans = []
for _ in range(n):
	ans.append(1)
	while len(ans) >= 2 and ans[-1] == ans[-2]:
		ans[-2] += 1
		ans.pop()
print(*ans)


n = int(input())
A = []
while n > 0:
	if n % 2 == 0:
		A.append(0)
		n //= 2
	else:
		A.append(1)
		n -= 1
		n //= 2
A = A[::-1]
for i in range(len(A)):
	if A[i] == 1:
		print(len(A) - i, end=' ')


def main():
	n = int(input())
	print(*solver(n))

def solver(n):
	s = bin(n)[2:]
	result = []
	for i in range(len(s)):
		if s[i] == '1':
			result.append(len(s) - i)
	return result
main()


t = int(input())
while t != 0:
	for i in range(17):
		if 2 ** i <= t < 2 ** (i + 1):
			print(i + 1, end=' ')
			t = t - 2 ** i


import math
n = int(input())

def func(n, op):
	if n == 1:
		op.append(1)
		return op
	elif n == 2:
		op.append(2)
		return op
	elif math.log(n, 2) % 1 == 0:
		op.append(int(math.log(n, 2) + 1))
		return op
	else:
		op.append(int(math.log(n, 2) + 1))
		n -= 2 ** int(math.log(n, 2))
		return func(n, op)
op = func(n, [])
for j in op:
	print(j, end=' ')


def binary_search_index_of(value, low, high):
	if low >= high:
		if 2 ** ((low + high) // 2) <= value:
			return (low + high) // 2
		elif 2 ** ((low + high) // 2) > value:
			return (low + high) // 2 - 1
	else:
		mid = (low + high) // 2
		if 2 ** mid > value:
			return binary_search_index_of(value, low, mid - 1)
		elif 2 ** mid < value:
			return binary_search_index_of(value, mid + 1, high)
		else:
			return mid
n = int(input())
c = n
while c > 0:
	r = binary_search_index_of(c, 0, 100000)
	c -= 2 ** r
	print(r + 1, end=' ')


n = int(input())
g = [1 for i in range(n)]
if len(g) == 1:
	print(1)
	exit()
while True:
	change = False
	l = g
	g = []
	i = 0
	while i < len(l):
		if i == len(l) - 1 or l[i] != l[i + 1]:
			g.append(l[i])
			i += 1
		else:
			g.append(l[i] + 1)
			i += 2
			change = True
	if not change:
		print(*g)
		exit()


n = int(input())
res = n
current = 1
current_idx = 1
ans = []
while res >= current:
	if res & current == current:
		ans.append(current_idx)
	current *= 2
	current_idx += 1
print(' '.join([str(i) for i in ans[::-1]]))


n = int(input())
ans = []
while n > 0:
	(t, k) = (1, 1)
	while t * 2 <= n:
		t *= 2
		k += 1
	ans.append(k)
	n -= t
for e in ans:
	print(e, end=' ')


f = lambda : map(int, input().split())
n = int(input())
s = '1 ' * n
for i in range(1, n // 2 + 1):
	s = s.replace(str(i) + ' ' + str(i), str(i + 1))
print(s)


b = list(bin(int(input()))[2:])[::-1]
out = list()
for i in range(len(b)):
	if b[i] == '1':
		out.append(i + 1)
print(' '.join(map(str, out[::-1])))


n = int(input())
ans = []
st = 1
for i in range(n):
	ans.append(1)
	while len(ans) > 1 and ans[-1] == ans[-2]:
		ans[-2] += 1
		ans.pop()
print(*ans)


n = int(input())
x = bin(n)[2:]
ll = len(x)
res = []
for i in range(ll):
	if x[i] == '1':
		res.append(str(ll - i))
print(' '.join(res))


3
import sys
n = int(sys.stdin.readline().rstrip())
A = []
for i in range(n):
	A.append(1)
	while len(A) >= 2 and A[-1] == A[-2]:
		A.pop()
		A[-1] += 1
print(' '.join(map(str, A)))


n = int(input())
(a, d) = ([n % 2], n // 2)
while d > 0:
	a.insert(0, d % 2)
	d = d // 2
l = len(a)
for x in range(l):
	if a[x] == 1:
		print(l - x, end=' ')


a = int(input())
b = []
for i in range(a):
	b.append(1)
	while True:
		if len(b) > 1 and b[-1] == b[-2]:
			b[-2] += 1
			del b[-1]
		else:
			break
print(*b)


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

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

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	a = []
	n = I()
	for i in range(n):
		x = 1
		while True:
			if len(a) > 0:
				y = a.pop()
				if y == x:
					x += 1
				else:
					a.append(y)
					a.append(x)
					break
			else:
				a.append(x)
				break
	return ' '.join((str(x) for x in a))
print(main())


__author__ = 'Admin'
n = int(input())
m = []
for i in range(n):
	m.append(1)
	for j in range(i):
		if m[len(m) - 1] == m[len(m) - 2] and len(m) > 1:
			m[len(m) - 2] += 1
			m.pop(m.index(m[len(m) - 1]))
		else:
			break
print(*m)


n = int(input())
for i in reversed(range(21)):
	if n & 1 << i != 0:
		print(i + 1, end=' ')


n = int(input())
for i in range(20, -1, -1):
	if n >= 2 ** i:
		print(i + 1, end=' ')
		n -= 2 ** i


n = int(input())
s = str(bin(n))[2:]
for i in range(len(s)):
	if s[i] == '1':
		print(len(s) - i, end=' ')


n = int(input())
s = []
for i in range(20, -1, -1):
	if n & 1 << i > 0:
		s += [str(i + 1)]
print(' '.join(s))


n = int(input())
curr = 1
result = []
while n > 0:
	if n % 2 == 1:
		result.append(curr)
	n //= 2
	curr += 1
print(' '.join(map(str, result[::-1])))


n = int(input())
power = [1] * 100
for i in range(1, 100):
	power[i] = power[i - 1] * 2
answer = []
a = 99
while n > 0:
	if n >= power[a]:
		n -= power[a]
		answer.append(a + 1)
	a -= 1
print(*answer)


n = int(input())
l = []
for i in range(n):
	l.append(1)
	while len(l) >= 2 and l[-1] == l[-2]:
		l.pop()
		l[-1] += 1
print(' '.join(map(str, l)))


n = int(input())
bindigits = []
start = 0
while n > 0:
	bindigits.insert(0, n % 2)
	n = n // 2
	start += 1
for bit in bindigits:
	if bit == 1:
		print(start, end=' ')
	start -= 1


import sys
import math

def good(n):
	while n % 2 == 0:
		n /= 2
	if n == 1:
		return True
	else:
		return False
arr = {1: [1]}
t = 2
while t < 100005:
	arr[t] = []
	if good(t):
		arr[t] = [int(math.log2(t)) + 1]
	else:
		tmp = 2 ** int(math.log2(t))
		arr[t] = arr[tmp] + arr[t - tmp]
	t = t + 1
a = int(input())
for i in arr[a]:
	print(i, end='  ')


def main_function():
	n = int(input())
	slimes = []
	for i in range(n):
		slimes.append(str(1))
		for k in range(len(slimes) - 1):
			if int(slimes[-1]) == int(slimes[-2]):
				slimes.pop()
				slimes[-1] = str(int(slimes[-1]) + 1)
			else:
				break
	return ' '.join(slimes)
print(main_function())


n = int(input())
ar = list()
i = int(1)
while n != 0:
	if n % 2 != 0:
		ar.append(i)
	n //= 2
	i += 1
ar = ar[::-1]
for t in ar:
	print(t, end=' ')


n = int(input())
bit = bin(n)[2:]
v = []
l = len(bit)
for i in range(l):
	if bit[l - i - 1] == '1':
		v.append(i + 1)
v.reverse()
print(' '.join(map(str, v)))


n = int(input())
s = [1]
for i in range(n - 1):
	s.append(1)
	while len(s) > 1 and s[-2] == s[-1]:
		s = s[:-2] + [1 + s[-1]]
print(*s)


n = int(input())
place = 1
arr = []
while n != 0:
	if n % 2 == 1:
		arr.append(place)
	place += 1
	n = n // 2
arr = arr[::-1]
print(*arr)


from collections import deque
from sys import stdin as fin
n = int(fin.readline())
stack = deque()
for i in range(n):
	stack.append(1)
	while len(stack) > 1 and stack[-1] == stack[-2]:
		stack.pop()
		stack.append(stack.pop() + 1)
for num in stack:
	print(num, end=' ')


dp = [[1]]
for i in range(2, 20):
	heh = []
	for elem in dp:
		x = [i] + elem
		heh.append(x)
	dp.append([i])
	dp += heh
print(*dp[int(input()) - 1])


n = int(input())
l = []
while n > 0:
	S = 1
	k = 1
	while S * 2 <= n:
		S = S * 2
		k = k + 1
	l.append(k)
	n = n - S
print(*l)


n = int(input())
a = [1]
for i in range(1, n):
	a.append(1)
	while len(a) > 1 and a[-1] == a[-2]:
		a = a[:-2] + [a[-1] + 1]
for i in range(len(a)):
	print(a[i], '', end='')


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


n = int(input())
slimes = list()
for _ in range(n):
	slimes.append(1)
	while len(slimes) > 1 and slimes[-1] == slimes[-2]:
		v = slimes.pop()
		slimes[-1] = v + 1
print(' '.join(map(str, slimes)))


def main():
	from math import log2, floor
	n = int(input())
	result = []
	while n > 0:
		x = floor(log2(n))
		result += [str(x + 1)]
		n -= 2 ** x
	print(' '.join(result))
main()


n = int(input())
l = []
for _ in range(n):
	l.append(1)
	while len(l) > 1 and l[-1] == l[-2]:
		l[-2] += 1
		l.pop()
print(*l, sep=' ')


def Inspect():
	global Slice
	k = len(Slice)
	for i in range(k):
		if Slice[i] != -1:
			Slice.append(Slice[i])
	Slice = Slice[k:]
	for i in range(len(Slice) - 1):
		if Slice[i] == Slice[i + 1]:
			return False
	return True
n = int(input())
Slice = [1] * n
while not Inspect():
	for i in range(len(Slice) - 1):
		if Slice[i] == Slice[i + 1]:
			Slice[i + 1] = Slice[i] + 1
			Slice[i] = -1
	Inspect()
print(*Slice)


import sys
import math
import bisect

def main():
	n = int(input())
	A = []
	for i in range(n):
		val = 1
		while len(A) and A[-1] == val:
			A.pop()
			val += 1
		A.append(val)
	print(' '.join(list((str(a) for a in A))))
main()


n = int(input())
row = []

def collapse(row):
	if len(row) <= 1:
		return
	elif row[-1] == row[-2]:
		row[-2] += 1
		row.pop()
		collapse(row)
	else:
		return
for i in range(n):
	row.append(1)
	collapse(row)
print(' '.join(map(str, row)))


n = int(input())
b = list(bin(n)[2:])
result = ''
indices = []
b.reverse()
for i in range(0, len(b)):
	if b[i] == '1':
		indices.append(i)
indices.reverse()
for i in indices:
	result += str(i + 1) + ' '
print(result)


n = int(input())
a = []
s = 0
z = ' '
if n == 1:
	print(1)
else:
	for i in range(n):
		a.append(1)
		n = n - 1
		for c in range(len(a)):
			if len(a) > 1:
				if a[-1] == a[-2]:
					s = a[-2] + 1
					a.remove(a[-2])
					a.remove(a[-1])
					a.append(s)
for d in a:
	print(d)


n = int(input())
ans = ''
for i in range(32, -1, -1):
	if n & 1 << i is not 0:
		ans += str(i + 1)
		ans += ' '
print(ans)


print(*[i + 1 for (i, x) in enumerate(bin(int(input()))[2:][::-1]) if x > '0'][::-1])


n = int(input())
k = []
for i in range(0, n):
	k.append(1)
	while len(k) > 1 and k[-1] == k[-2]:
		k[-2] += 1
		del k[-1]
first = True
for i in k:
	if first:
		first = False
	else:
		print(' ', end='')
	print(i, end='')


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
n = get_int()
lst = []
while n > 0:
	n -= 1
	lst.append(1)
	while len(lst) >= 2 and lst[-2] == lst[-1]:
		lst[-2] = lst[-1] + 1
		lst.pop()
print(*lst)


l = [0] + list(reversed(bin(int(input()))))
for i in range(len(l) - 2, 0, -1):
	if l[i] == '1':
		print(i, end=' ')


import math
a = []
n = int(input())
amari = n
while amari != 0:
	a.append(math.floor(math.log(amari, 2)) + 1)
	amari -= 2 ** math.floor(math.log(amari, 2))
print(' '.join(map(str, a)))


n = int(input())
nn = n
a = []
while nn:
	if len(a) > 1:
		if a[0] != a[1] and a[-1] != a[-2]:
			a.append(1)
			nn -= 1
	else:
		a.append(1)
		nn -= 1
	while len(a) > 1 and (a[0] == a[1] or a[-1] == a[-2]):
		if a[0] == a[1]:
			a[1] += 1
			a = a[1:]
		if len(a) > 1 and a[-1] == a[-2]:
			a[-2] += 1
			a = a[:-1]
for i in a:
	print(i, end=' ')
print()


n = int(input())
if n == 1:
	print(1)
elif n == 2:
	print(2)
else:
	a = [2]
	for i in range(n - 2):
		if len(a) == 1:
			a.append(1)
		elif a[-1] != a[-2]:
			a.append(1)
		else:
			while len(a) > 1 and a[-1] == a[-2]:
				del a[-1]
				a[-1] += 1
		while len(a) > 1 and a[-1] == a[-2]:
			del a[-1]
			a[-1] += 1
	print(*a)


def bina(x):
	ret = ''
	while x > 0:
		ret = str(x % 2) + ret
		x = x // 2
	return ret
a = int(input())
b = bina(a)
l = len(b)
print(l - b.find('1'), end='')
for i in range(b.find('1') + 1, l):
	if b[i:i + 1] == '1':
		print(' ' + str(l - i), end='')


slimes = int(input())
array = list()
counter = 0
while slimes:
	array.append(1)
	slimes -= 1
	counter2 = len(array) - 1
	while counter2 > 0:
		if counter2 - 1 < 0:
			break
		if array[counter2] == array[counter2 - 1]:
			del array[counter2]
			array[counter2 - 1] += 1
		counter2 -= 1
print(' '.join(map(str, array)))


def lenOfList(list):
	sum = 0
	for x in list:
		sum += 1
	return sum
n = int(input())
abdo = ''
row = []
if n == 1:
	print(1)
else:
	row.append(1)
	while n > 1:
		n -= 1
		row.append(1)
		while row[-1] == row[-2]:
			row.append(row[-1] + 1)
			row.remove(row[-2])
			row.remove(row[-2])
			if lenOfList(row) < 2:
				break
	for x in row:
		abdo += str(x) + ' '
	print(abdo)


N = int(input())
ans = []
cnt = 1
while N != 0:
	if N % 2 != 0:
		ans.append(cnt)
	N = N // 2
	cnt += 1
ans.reverse()
print(' '.join(map(str, ans)))


import math
n = int(input())
ans = [x + 1 for x in range(n.bit_length(), -1, -1) if n >> x & 1]
for x in ans:
	print(x, end=' ')


n = int(input())
v = []
for i in range(0, n):
	v.append(1)
	while True:
		if len(v) > 1 and v[-1] == v[-2]:
			v.pop()
			v[-1] += 1
		else:
			break
print(*v)


n = int(input())
podokonnik = []
while n > 0:
	podokonnik.append(1)
	while len(podokonnik) >= 2 and podokonnik[-1] == podokonnik[-2]:
		podokonnik[-2] = podokonnik[-2] + 1
		podokonnik.pop()
	n -= 1
for elem in podokonnik:
	print(elem, end=' ')


n = int(input())
a = [2 ** i for i in range(17)]
i = 16
while n < a[i]:
	i -= 1
while n > 0:
	print(i + 1, end=' ')
	n -= a[i]
	while i >= 0 and n < a[i]:
		i -= 1


import sys
n = int(input(), 10)
b = bin(n)
l = len(b)
for i in b:
	if i == '1':
		print(l, end='')
		if l != 0:
			print(' ', end='')
	l = l - 1


n = int(input())
while n != 0:
	a = 1
	k = 0
	while a <= n:
		a *= 2
		k += 1
	a //= 2
	print(k, end=' ')
	n -= a


import math

def solve():
	n = int(input())
	for i in range(100, -1, -1):
		if n & 2 ** i:
			print(i + 1, end=' ')
	print()
t = 1
while True:
	solve()
	t -= 1
	if t <= 0:
		break


x = int(input())
a = [1]
for i in range(x - 1):
	if a[len(a) - 1] == 1:
		a[len(a) - 1] += 1
		while len(a) > 1 and a[len(a) - 1] == a[len(a) - 2]:
			a.pop()
			a[len(a) - 1] += 1
	else:
		a.append(1)
for i in a:
	print(i)


def solve():
	n = bin(int(input()))[-1:1:-1]
	print(' '.join(map(str, [i + 1 for i in range(len(n)) if n[i] == '1'][::-1])))
solve()


n = int(input())
d = []
for i in range(n):
	d.append(1)
	if len(d) >= 2:
		while d[-1] == d[-2]:
			if d[-1] == d[-2]:
				r = d[-1] + 1
				d.append(r)
				d.pop(-2)
				d.pop(-2)
			if len(d) < 2:
				break
print(*d)


n = int(input())
p = []

def zzip(p):
	while True:
		if len(p) < 2:
			return p
		sl = p.pop()
		slr = p.pop()
		if sl == slr:
			p.append(sl + 1)
		else:
			p.append(slr)
			p.append(sl)
			return p
for i in range(0, n):
	p.append(1)
	p = zzip(p)
for s in p:
	print(s, end=' ')


n = int(input())
res = []
while n > 0:
	res.append(n % 2)
	n //= 2
ans = []
for i in range(len(res)):
	if res[i] > 0:
		ans.append(i + 1)
ans.reverse()
print(' '.join(map(str, ans)))


n = int(input())
l = []
while n > 0:
	i = 0
	while pow(2, i) <= n:
		i += 1
	l.append(i)
	n -= pow(2, i - 1)
for e in l:
	print(e, end=' ')
print()


n = int(input())
a = [0] * 100
tool = 1
a[0] = 1
f = 1
for i in range(1, n):
	a[tool] = 1
	tool += 1
	f += 1
	if f == 2:
		f = 0
		tool -= 1
		a[tool - 1] = a[tool] + 1
		c = 0
		for j in range(tool - 1, 0, -1):
			if a[j] == a[j - 1]:
				a[j - 1] = a[j] + 1
				c += 1
			else:
				break
		tool -= c
	else:
		pass
print(*a[:tool])


k = int(input())
a = [0]
i = 0
while i < k:
	a.append(1)
	while a[len(a) - 1] == a[len(a) - 2]:
		a.remove(a[len(a) - 1])
		a[len(a) - 1] += 1
	i += 1
for i in range(1, len(a)):
	print(a[i], end=' ')


n = int(input())
stack = [1]
for i in range(1, n):
	if stack[-1] == 1:
		stack[-1] = 2
		while True:
			if len(stack) >= 2:
				last = stack.pop()
				if stack[-1] == last:
					stack[-1] = last + 1
				else:
					stack.append(last)
					break
			else:
				break
	else:
		stack.append(1)
print(*stack)


n = int(input())
i = 1
arr = []
while True:
	if n & 1 == 1:
		arr.append(i)
	n >>= 1
	i = i + 1
	if n == 0:
		break
outstr = ''
for elm in arr:
	outstr = str(elm) + ' ' + outstr
print(outstr)


n = int(input())
l = [1]
for i in range(1, n):
	l.append(1)
	for j in range(len(l)):
		if len(l) > 1 and l[-1] == l[-2]:
			l[-2] = l[-2] + 1
			l.pop(-1)
		else:
			break
print(*l)


def solve(n):
	a = [1]
	n -= 1
	while n:
		a.append(1)
		while len(a) >= 2 and a[-1] == a[-2]:
			a[-1] = a.pop() + 1
		n -= 1
	return ' '.join(map(str, a))

def main():
	n = int(input())
	print(solve(n))
main()


from math import *
from cmath import *
from itertools import *
from decimal import *
from fractions import *
from sys import *
from types import CodeType, new_class
n = int(input())
for x in range(20, -1, -1):
	if n >> x & 1:
		print(x + 1, end=' ')


n = int(input())
a = []

def simplify(a):
	if len(a) <= 1:
		return
	if a[-2] == a[-1]:
		del a[-1]
		a[-1] += 1
		simplify(a)
for i in range(n):
	a.append(1)
	simplify(a)
print(' '.join(map(str, a)))


n = int(input())
k = []
for x in range(n):
	k.append(1)
	while len(k) >= 2 and k[-2] == k[-1]:
		k.pop()
		k[-1] += 1
print(' '.join(map(str, k)))


n = int(input())
l = '{:b}'.format(n)
r = []
for (i, c) in enumerate(l):
	if c == '1':
		r += [str(len(l) - i)]
print(' '.join(r))


n = int(input())
a = []
while n > 0:
	a.append(1)
	n = n - 1
	while len(a) > 1 and a[len(a) - 1] == a[len(a) - 2]:
		x = a[len(a) - 1] + 1
		a.pop()
		a.pop()
		a.append(x)
for i in a:
	print(i, end=' ')


s = bin(int(input()))[2:]
sol = []
for (i, j) in enumerate(s):
	if j == '1':
		sol.append(str(len(s) - i))
print(' '.join(sol))


n = bin(int(input()))[2:]
l = len(n)
for i in n:
	if i == '1':
		print(l, end=' ')
	l -= 1


n = int(input())
a = []
for i in range(0, n):
	a.append(1)
	while len(a) > 1 and a[-1] == a[-2]:
		a.pop()
		a.append(a.pop() + 1)
print(' '.join((str(j) for j in a)))


n = int(input())
p = []
while n != 0:
	while len(p) >= 2 and p[-2] == p[-1]:
		p[-2] += 1
		p.pop()
	p.append(1)
	n -= 1
while len(p) >= 2 and p[-2] == p[-1]:
	p[-2] += 1
	p.pop()
print(*p)


n = int(input())
L = []
r = 1
ct = 1
while n >= r:
	if n & r > 0:
		L.append(ct)
	r *= 2
	ct += 1
L.reverse()
print(' '.join(map(str, L)))


n = int(input())
l = [1]
for i in range(2, n + 1):
	l += [1]
	while len(l) >= 2:
		if l[-1] == l[-2]:
			l = l[:-2] + [l[-1] + 1]
		else:
			break
print(' '.join(map(str, l)))


n = int(input())
a = []
for i in range(n):
	a.append(1)
	while len(a) > 1:
		if a[len(a) - 2] == a[len(a) - 1]:
			a[len(a) - 2] = a[len(a) - 1] + 1
			del a[len(a) - 1]
		else:
			break
for i in range(len(a)):
	print(a[i], end=' ')


n = int(input())
p = []
for i in range(n):
	p.append(1)
	while len(p) >= 2 and p[-1] == p[-2]:
		p[-2] += 1
		p.pop()
for i in p:
	print(i, end=' ')


import sys
n = int(sys.stdin.read())
slimes = [1]
for i in range(n - 1):
	slimes.append(1)
	pos = len(slimes) - 1
	while pos > 0 and slimes[pos] == slimes[pos - 1]:
		del slimes[pos]
		slimes[pos - 1] += 1
		pos -= 1
print(' '.join((str(slime) for slime in slimes)))


n = int(input())
ans = list()
for i in range(n):
	ans.append(1)
	while len(ans) > 1 and ans[-1] == ans[-2]:
		t = ans.pop()
		ans[-1] = t + 1
print(' '.join(map(str, ans)))


n = int(input())
s = bin(n)[2:]
l = len(s)
lst = []
for i in range(l):
	if s[i] == '1':
		print(l - i, end=' ')


x = int(input())
t = 0
r = []
t1 = 0
while t != x:
	r.append(1)
	if len(r) > 1:
		t1 = len(r)
		for i in range(t1):
			if len(r) == 1:
				continue
			if r[len(r) - 1] == r[len(r) - 2]:
				r[len(r) - 2] = r[len(r) - 2] + 1
				if len(r) == 1:
					break
				else:
					r.pop(len(r) - 1)
			else:
				break
	t = t + 1
for i in range(len(r)):
	print(r[i])


def answer(n):
	x = []
	while n != 0:
		temp = n % 2
		n //= 2
		x.append(temp)
	for i in reversed(range(len(x))):
		if x[i] == 1:
			print(i + 1, end=' ')
n = int(input())
answer(n)


def main():
	n = int(input())
	a = []
	for i in range(n):
		a.append(1)
		while len(a) > 1 and a[-1] == a[-2]:
			a.pop()
			a[-1] += 1
	print(' '.join((str(i) for i in a)))
main()


n = int(input())
arr = []
for i in range(n):
	arr.append(1)
	while len(arr) >= 2 and arr[-1] == arr[-2]:
		(a, b) = (arr.pop(), arr.pop())
		arr.append(a + 1)
print(' '.join(map(str, arr)))


n = int(input())
curr = [-7]
for i in range(n):
	curr.append(1)
	while curr[-1] == curr[-2]:
		curr[-2] += 1
		curr.pop()
print(' '.join(map(str, curr[1:])))


from sys import *
inp = lambda : stdin.readline()

def main():
	n = int(inp())
	ans = []
	for i in range(20, -1, -1):
		if n & 1 << i:
			ans.append(str(i + 1))
	print(' '.join(ans))
main()


n = int(input())
a = str(bin(n)[2:])
b = a[::-1]
t = []
for k in range(len(a)):
	if b[k] == '1':
		t.append(k + 1)
print(*t[::-1])


n = int(input())
k = 1
a = []
while n > 0:
	if n & 1:
		a.append(k)
	k += 1
	n = n >> 1
a.reverse()
ans = ''
for i in range(len(a)):
	ans += str(a[i]) + ' '
print(ans)


n = int(input())
out = []
cur = 1
while n > 0:
	if n % 2 == 1:
		out.append(cur)
	cur += 1
	n //= 2
out.reverse()
print(*out)


n = int(input())
bit = []
while n > 0:
	bit.append(n % 2)
	n //= 2
v = []
for i in range(len(bit)):
	if bit[i] > 0:
		v.append(i + 1)
v.reverse()
print(' '.join(map(str, v)))


import itertools

def combine(data):
	changed = True
	while changed:
		if len(data) >= 2 and data[-1] == data[-2]:
			res = data[0:-2]
			res.append(data[-1] + 1)
			changed = True
			data = res
		else:
			changed = False
	return data

def main():
	n = int(input())
	data = [1]
	for i in range(2, n + 1):
		data.append(1)
		data = combine(data)
	print(' '.join([str(d) for d in data]))
main()


x = int(input())
p = [1]
for i in range(2, x + 1):
	p.append(1)
	n = len(p) - 1
	while n > 0:
		if p[n] == p[n - 1]:
			p[n - 1] = p[n] + 1
			p[n:n + 1] = []
		else:
			break
		n = len(p) - 1
for i in p:
	print(i, end=' ')


n = int(input())
lst = []
while n >= 1:
	if len(lst) == 0:
		lst.append(1)
	else:
		lst.append(1)
		while lst[len(lst) - 1] == lst[len(lst) - 2] and len(lst) > 1:
			k = lst[len(lst) - 1] + 1
			lst.pop()
			lst.pop()
			lst.append(k)
	n -= 1
for i in lst:
	print(i, end=' ')


def toBin(num):
	buf = ''
	while True:
		(num, rest) = (num // 2, num - num // 2 * 2)
		buf = str(rest) + buf
		if num == 0:
			break
	return int(buf)

def main():
	num = int(input())
	num_bin = toBin(num)
	num_bin_str = str(num_bin)
	num_bin_str_len = len(num_bin_str)
	solutions = []
	for pos in range(0, num_bin_str_len):
		if num_bin_str[pos] == '1':
			solutions.append(str(num_bin_str_len - pos))
	print(' '.join(solutions))
main()


n = int(input())
import math
s = ''
a = 1
while n > 0:
	a = int(math.log2(n)) + 1
	s += str(a) + ' '
	n -= 2 ** (a - 1)
print(s)


n = int(input())
l = []
s = '{0:b}'.format(n)
j = 0
for i in range(len(s), 0, -1):
	if s[j] == '1':
		l.append(i)
	j += 1
print(*l)


def main():
	n = int(input())
	lst = list()
	for i in range(n):
		lst.append(1)
		cnt = len(lst) - 1
		while cnt - 1 >= 0 and lst[cnt - 1] == lst[cnt]:
			lst[cnt - 1] += 1
			del lst[cnt]
			cnt -= 1
	print(' '.join(list(map(str, lst))))
main()


n = int(input())
slimes = []
for x in range(n):
	slimes.append(1)
	while len(slimes) >= 2 and slimes[-1] == slimes[-2]:
		a = slimes[-1]
		del slimes[-1], slimes[-1]
		slimes.append(a + 1)
print(' '.join(map(str, slimes)))


a = []
for i in range(int(input())):
	a += [1]
	while len(a) > 1 and a[-1] == a[-2]:
		a.pop()
		a[-1] += 1
for i in a:
	print(i, end=' ')


n = int(input())
a = [0] * 10000000
cnt = -1
while n:
	r = n % 2
	n //= 2
	cnt += 1
	a[cnt] = r
for i in range(cnt + 1):
	if a[cnt - i] == 1:
		print(cnt - i + 1, end=' ')


from math import log2
n = int(input())
l = 1 + int(log2(n))
out = []
while n:
	if n >= 2 ** l:
		n -= 2 ** l
		out.append(str(l + 1))
	l -= 1
print(' '.join(out))


n = int(input())
rez = []
i = 1
while n > 0:
	if n % 2:
		rez = [i] + rez
	n //= 2
	i += 1
print(*rez)


n = int(input())
b = list(bin(n))[2:]
b.reverse()
s = str()
for i in range(len(b)):
	if b[i] == '1':
		s = str(i + 1) + ' ' + s
print(s)


def get(k):
	find = False
	for i in range(len(k)):
		if k[i] == 0:
			k[i] = 1
			break
		else:
			k[i] = 0
	else:
		k.append(1)
	return k
n = int(input())
k = []
for i in range(n):
	k = get(k)
for i in range(len(k) - 1, -1, -1):
	if k[i]:
		print(i + 1, end=' ')


n = int(input())
b = bin(n)[2:]
x = b[::-1]
l = []
for i in range(len(b)):
	if x[i] == '1':
		l.append(i + 1)
print(*l[::-1])


from sys import setrecursionlimit
setrecursionlimit(10 ** 6)
numSlimes = int(input())
row = list()
aSlime = 1
for i in range(numSlimes):
	row.append(aSlime)
	while len(row) >= 2 and row[-2] == row[-1]:
		v1 = row.pop()
		v2 = row.pop()
		v = v1 + 1
		row.append(v)
print(*row)


n = int(input())
ls = []
for i in range(n):
	ls.append(1)
	try:
		while ls[-2] == ls[-1]:
			ls[-2] += 1
			ls = ls[:-1]
	except:
		pass
for j in ls:
	print(j, end=' ')
print()


n = int(input())

def rec(l):
	while l[-1] == l[-2]:
		l[-2] += 1
		l.pop()
	return l
res = [0]
for i in range(n):
	res.append(1)
	res = rec(res)
print(' '.join(map(str, res[1:])))


s = bin(int(input()))[2:]
for (i, j) in enumerate(s):
	if j == '1':
		print(len(s) - i)


alph = 'abcdefghijklmnopqrstuvwxyz'
n = int(input())
s = ''
while n != 0:
	s += str(n % 2)
	n //= 2
for i in range(len(s) - 1, -1, -1):
	if s[i] == '1':
		print(i + 1, end=' ')


n = int(input())
b = [i for i in str(bin(n))]
b = b[2:]
b = list(map(int, b))
l = len(b)
i = 0
while i < l:
	b[i] = b[i] * (l - i)
	i += 1
for i in b:
	if i != 0:
		print(str(i), end=' ')


A = [i for (i, ch) in enumerate(reversed(bin(int(input()))), 1) if ch == '1']
print(*reversed(A))


num = int(input())
ans = []
while num:
	ans.append(1)
	while len(ans) > 1 and ans[-1] == ans[-2]:
		x = ans.pop() + 1
		ans[-1] = x
	num -= 1
print(*ans)


a = int(input())
b = bin(a)
i = 2
while i < len(b):
	if b[i] == '1':
		print(len(b) - i, end=' ')
	i += 1


n = int(input())
a = [2 ** i for i in range(20)]
ans = []
while n > 0:
	for i in range(19, -1, -1):
		if n >= a[i]:
			print(i + 1, end=' ')
			n -= a[i]
			break


x = int(input())
L = [1]
for i in range(2, x + 1):
	L.append(1)
	a = len(L) - 1
	while a > 0:
		if L[a] == L[a - 1]:
			L[a - 1] = L[a] + 1
			L[a:a + 1] = []
		else:
			break
		a = len(L) - 1
		if a == 0:
			break
for i in L:
	print(i, end=' ')


n = int(input())
i = 0
a = []
while n != 1:
	i += 1
	if n % 2:
		a.insert(0, i)
	n = n // 2
print(i + 1, *a)


n = int(input())
v = []
t = 0
s = ''
while n != 0:
	s += str(n % 2)
	n //= 2
for i in range(len(s)):
	if s[i] == '1':
		v.append(i + 1)
for i in range(len(v) - 1, -1, -1):
	print(v[i], end=' ')


import math
n = int(input())
while n > 2:
	k = math.floor(math.log(n, 2))
	n -= 2 ** k
	print(k + 1, end=' ')
if n > 0:
	print(n, end=' ')


print(' '.join([str(v + 1) for (v, k) in enumerate(bin(int(input()))[::-1]) if k == '1'][::-1]))


import sys
inputNum = int(input())
outputString = ''
isFirst = True
while inputNum > 0:
	combineTier = 1
	combineValue = 1
	while inputNum >= combineValue:
		combineTier = combineTier + 1
		combineValue = combineValue * 2
	combineTier = combineTier - 1
	combineValue = combineValue / 2
	inputNum = inputNum - combineValue
	if isFirst:
		outputString = outputString + str(combineTier)
		isFirst = False
	else:
		outputString = outputString + ' ' + str(combineTier)
print(outputString)


n = int(input())
li = []
li.append(1)
j = 1
for i in range(n - 1):
	li.append(j)
	while len(li) > 1:
		if li[-1] == li[-2]:
			li[len(li) - 2] += 1
			li.pop(len(li) - 1)
		else:
			break
print(*li)


n = int(input())
out = []
cur = 1
while n > 0:
	if n % 2 == 1:
		out.append(cur)
	cur += 1
	n //= 2
for v in reversed(out):
	print(v, end=' ')
print()


def deep(n):
	if n != 0:
		i = 0
		while n > 2 ** i:
			i += 1
		if n == 2 ** i:
			print(i + 1)
		else:
			print(i, end=' ')
			n -= 2 ** (i - 1)
			deep(n)
n = int(input())
deep(n)


n = int(input())
m = n
S = 1
d = []
while m >= 1:
	if m % 2 == 0:
		m = m // 2
		S = S + 1
	else:
		d.append(S)
		S = S + 1
		m = m // 2
for i in range(1, len(d) + 1):
	print(d[len(d) - i], end=' ')


num = str(bin(int(input()))).replace('0b', '')
size = len(num)
line = list()
for i in range(size):
	if num[i] == '1':
		line.append(str(size - i))
print(' '.join(line))


a = []
for x in range(int(input())):
	a.append(1)
	while len(a) > 1 and a[-1] == a[-2]:
		a.pop()
		a.append(a.pop() + 1)
print(*a)


n = int(input())
bin_n = bin(n)[2:]
l = len(bin_n)
ans = [str(l - i) for i in range(l) if bin_n[i] == '1']
print(' '.join(ans))


n = int(input())
b = bin(n)[2:]
l = []
for (i, c) in enumerate(b):
	if c == '1':
		l.append(len(b) - i)
print(' '.join(map(str, l)))


n = int(input())
s = bin(n)[2:]
num = len(s)
for f in s:
	if f == '1':
		print(num, end=' ')
	num -= 1


n = int(input())
slime = []
i = 1
while n != 0:
	slime.append(1)
	while len(slime) > 1 and slime[-1] == slime[-2]:
		slime[-2] = slime[-2] + 1
		slime.remove(slime[-1])
	n = n - 1
print(*slime)


n = int(input())
arr = [1]
for i in range(n - 1):
	arr.append(1)
	while len(arr) >= 2 and arr[-1] == arr[-2]:
		arr[-2] += 1
		del arr[-1]
print(*arr)


n = int(input())
for i in range(30, -1, -1):
	cur = 2 ** i
	if n >= cur:
		print(i + 1, end=' ')
		n -= cur


n = int(input())
slimes = []
slimes.append(1)
for i in range(n - 1):
	slimes.append(1)
	while 1:
		if len(slimes) == 1 or slimes[-1] != slimes[-2]:
			break
		slimes[-2] += 1
		del slimes[-1]
print(*slimes)


n = int(input())
a = []
for j in range(n):
	a.append(1)
	if len(a) > 1:
		for i in range(len(a)):
			if a[len(a) - 2] == a[len(a) - 1]:
				a[len(a) - 2] = a[len(a) - 2] + 1
				del a[len(a) - 1]
				if len(a) == 1:
					break
print(*a)


n = int(input())
res = []
while n:
	res.append(n % 2)
	n //= 2
for i in range(len(res)):
	if res[i]:
		res[i] = i + 1
res.reverse()
s = ''
for ares in res:
	if ares:
		s += str(ares) + ' '
print(s.strip())


n = int(input())
ans = 1
while n != 0:
	ans = ans * 10 + n % 2
	n = n // 2
ans = str(ans)[1:]
for i in range(len(ans) - 1, -1, -1):
	if ans[i] == '1':
		print(i + 1, end=' ')


from math import *
x = int(input())
while x > 0:
	print(floor(log2(x)) + 1, end=' ')
	x -= pow(2, floor(log2(x)))
print()


from collections import deque
Size = int(input())
List = deque()
for i in range(Size):
	List.append(1)
	while True:
		if len(List) > 1 and List[-1] == List[-2]:
			List.pop()
			List[-1] += 1
		else:
			break
print(*List)


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


n = int(input())
d = {}
i = 1
while n > 0:
	d[i] = n % 2
	n = n // 2
	i += 1
for i in reversed(sorted(d.keys())):
	if d[i]:
		print(i, end=' ')


def solve(l):
	if len(l) > 1:
		if l[-1] == l[-2]:
			a = l[-1]
			l.pop()
			l.pop()
			l.append(a + 1)
		if len(l) != len(set(l)):
			l = solve(l)
			return l
		else:
			return l
n = int(input())
l = []
for i in range(n):
	l.append(1)
	if len(l) != len(set(l)):
		l = solve(l)
print(*l)


def solution(n):
	if n == 1:
		return 1
	l1 = [1]
	i = 0
	while i < n - 1:
		l1.append(1)
		j = 0
		while len(set(l1)) != len(l1):
			if l1.index(min(l1)) < len(l1):
				if l1[l1.index(min(l1))] == l1[l1.index(min(l1)) + 1]:
					l1[l1.index(min(l1))] += 1
					l1.remove(min(l1))
		i += 1
	i = 0
	c_out = ''
	while i < len(l1):
		c_out += str(l1[i])
		i += 1
		if i != len(l1):
			c_out += ' '
	return c_out

def answer():
	n = int(input())
	print(solution(n))
answer()


n = int(input())
s = bin(n)
s = s[2:]
k = len(s)
for (i, x) in enumerate(s):
	if x == '1':
		print(k - i, end=' ')


n = int(input())
a = []
while n > 0:
	n -= 1
	a.append(1)
	while len(a) > 1 and a[-1] == a[-2]:
		a[-2] = a[-2] + 1
		a.pop()
for e in a:
	print(e, end=' ')


n = int(input())
ans = []
num = list(bin(n)[2:])
size = len(num)
for idx in range(size):
	if num[idx] == '1':
		ans.append(size - idx)
print(' '.join(map(str, ans)))


n = int(input())
mylist = []

def RecursiveDivision(new_n, mylist):
	mylist.append(new_n % 2)
	nn = int(new_n / 2)
	if nn > 0:
		RecursiveDivision(nn, mylist)
	else:
		return mylist
RecursiveDivision(n, mylist)
mylist.reverse()
mystring = str()
N = len(mylist)
for num in mylist:
	for repeat in range(num):
		mystring += str(N) + ' '
	N -= 1
print(mystring)


n = int(input())
v = []
for i in range(n):
	v.append(1)
	while len(v) >= 2 and v[-2] == v[-1]:
		x = v.pop()
		v.pop()
		v.append(x + 1)
print(' '.join([str(x) for x in v]))


N = int(input())
ans = []
i = 0
while N >> i:
	if N >> i & 1:
		ans.append(i + 1)
	i += 1
print(*ans[::-1])


try:
	while True:
		n = int(input())
		for i in range(31, -1, -1):
			if n & 1 << i:
				print(i + 1, end=' ')
		print()
except EOFError:
	pass


n = int(input())
x = bin(n)[2:]
answer = []
counter = 1
for i in x[::-1]:
	if i != '0':
		answer.append(str(int(i) * counter))
	counter += 1
x = ''
for i in range(len(answer) - 1, -1, -1):
	x += answer[i] + ' '
print(x)


n = int(input())
x = bin(n)
x = x[2:]
x = x[::-1]
a = []
l = len(x)
for i in range(l):
	if x[i] == '1':
		a.append(i + 1)
a = a[::-1]
print(*a, sep=' ')


n = int(input())
ans = []
target = bin(n)[2:][::-1]
for i in range(len(target)):
	if target[i] == '1':
		ans.append(i + 1)
print(*ans[::-1])


a = [0]
for _ in range(int(input())):
	a += [1]
	while a[-2] == a[-1]:
		a.pop()
		a[-1] += 1
print(*a[1:])


n = int(input())
k = bin(n)[2:]
mas = []
l = len(k)
for a in range(l):
	if k[a] == '1':
		mas.append(str(l - a))
print(' '.join(mas))


n = int(input())
p = []
for i in range(n):
	p.append(1)
	try:
		while p[-1] == p[-2]:
			p[-2] += 1
			del p[-1]
	except:
		pass
for k in p[:-1]:
	print(k, sep=' ', end=' ')
print(p[-1])


a = bin(int(input()))[:1:-1]
b = [i + 1 for i in range(len(a)) if a[i] == '1']
print(' '.join(map(str, b[::-1])))


from collections import deque
n = int(input())
data = deque([1])
while n > 1:
	data.append(1)
	n -= 1
	while len(data) > 1 and data[-1] == data[-2]:
		help = data[-1] + 1
		data.pop()
		data.pop()
		data.append(help)
print(*list(data))


list = [0]
n = int(input())
for i in range(1, n + 1):
	list.append(1)
	while list[len(list) - 1] == list[len(list) - 2]:
		del list[len(list) - 2]
		list[len(list) - 1] += 1
for i in range(1, len(list)):
	print(list[i], end=' ')


n = int(input())
window = []
while n > 0:
	window.append(1)
	n -= 1
	while len(window) > 1 and window[-1] == window[-2]:
		window[-2] += 1
		window.pop()
print(' '.join(map(str, window)))


x = int(input())
p = 2
a = []
b = []
for i in range(x):
	if p ** i > x:
		break
	a.append(p ** i)
a = a[::-1]
for i in range(len(a)):
	if a[i] <= x:
		b.append(len(a) - i)
		x = x - a[i]
	if x == 0:
		exit(print(*b))


T_ON = 0
DEBUG_ON = 1
MOD = 998244353

def solve():
	n = read_int()
	A = []
	for i in range(63, -1, -1):
		if n & 1 << i:
			A.append(i + 1)
	print_nums(A)

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def debug(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import math
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 read_int():
	return int(input())

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

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def First():
	print('First')

def Second():
	print('Second')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

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

def is_even(x):
	return x % 2 == 0

def is_odd(x):
	return x % 2 == 1

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

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

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P
main()


n = int(input())
import math
res = []
while n > 0:
	i = math.floor(math.log(n, 2))
	n -= 2 ** i
	res.append(i + 1)
print(*res)


def main():
	(n, res, mask, x) = (int(input()), [], 1, 1)
	while n >= mask:
		if n & mask:
			res.append(x)
		mask *= 2
		x += 1
	print(*[x for x in reversed(res) if x])
main()


def slizni(n):
	lst = list()
	while n > 0:
		if n % 2 == 0:
			lst.append(0)
			n //= 2
		else:
			lst.append(1)
			n -= 1
			n //= 2
	a = lst[::-1]
	b = list()
	for i in range(len(a)):
		if a[i] == 1:
			b.append(len(a) - i)
	return b
print(*slizni(int(input())))


n = int(input(''))
a = []
while n > 0:
	a.append(n - 2 * int(n / 2))
	n = int(n / 2)
n = len(a)
s = ''
while n > 0:
	n -= 1
	for i in range(a[n]):
		s += str(n + 1) + ' '
print(s[0:-1])