From POJ 2248, the data range has been enlarged by Mars, so you need to cut the useless branches of the searching tree.

An addition chain for is an integer sequence with the following four properties:

For each there exist two (not necessarily different) integers and with

You are given an integer . Your job is to construct an addition chain for n with minimal length. If there is more than one such sequence, any one is acceptable.

For example, and are both valid solutions when you are asked for an addition chain for .

输入格式

The input will contain one or more test cases. Each test case consists of one line containing one integer . Input is terminated by a value of zero (0) for .

输出格式

For each test case, print one line containing the required integer sequence. Separate the numbers by one blank.

Hint: The problem is a little time-critical, so use proper break conditions where necessary to reduce the search space.