#### Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

The 3*n*+1 sequence is generated as follows. Starting from a number *n*, we get the next number in the sequence by doing this:

- If *n* is even, the next number is *n*/2.

- If *n* is odd, the next number is 3*n*+1.

We continue this way until we reach 1.

Your task is: given *n*≤10000, generate the sequence.

## Sample Input 1

5

## Sample Output 1

5 16 8 4 2 1

## Sample Input 2

7

## Sample Output 2

7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1

### Tags

### Subtasks and Limits

Subtask | Score | #TC | Time | Memory | Scoring |
---|---|---|---|---|---|

1 | 100 | 5 | 1s | 32MB | Average |

2 | 0 | 0 | 1s | 32MB | Average |

### Judge Compile Command

g++-7 ans.cpp -o 3n+1 -Wall -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512