#include<bits/stdc++.h>
using namespace std;
#define int long long
stack<int> s;
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin>>n;
int x=n;
while(x!=1){
if(!x%2) s.push(x/2),x/=2;
else s.push(x*3+1),x=x*3+1;
}
cout<<1<<" ";
while(!s.empty()){cout<<s.top()<<" ";s.pop();}
return 0;
}