#include <bits/stdc++.h>
using namespace std;
const int N = 210;
int a[N], cnt;
int n;
int main() {
cin >> n;
while (n > 1) {
a[cnt++] = n;
if (n % 2 == 0) n /= 2;
else n = n * 3 + 1;
}
//最后一个是1
a[cnt] = 1;
for (int i = cnt; i >= 0; i--)
printf("%d ", a[i]);
return 0;
}