#include<iostream>
#include<algorithm>
#include<vector>
int main() {
int n;
std::cin >> n;
std::vector<int>s;
bool flag = false;
while (!(n == 1 && flag == true)) {
s.push_back(n);
if (n % 2 == 1) {
n = n * 3 + 1;
}
else {
n /= 2;
}
if (n == 1) {
flag = true;
s.push_back(n);
}
}
int temp=0;
while (s.size()!=0) {
temp = *(s.end() - 1);
s.pop_back();
std::cout << temp <<" ";
}
return 0;
}