loop do
	weight=[1,2,4,8,16,32,64,128,256,512]

	thing=gets.to_i
	if thing == 0
		break
	end
	for x in 1..10
		sample=weight.combination(x).to_a
		for y in 0..sample.size-1
			if sample[y].inject(0){|result,item| result + item} == thing
				for z in 0..sample[y].size-1
					print sample[y][z]," "
				end
				break
			end
		end
	end
end