#include <bits/stdc++.h>
using namespace std;
int opo[10001];
int main()
{
int u;
cin>>u;
int o=u;
int h=0;
while(u)
{
opo[h]=u;
h++;
if(u%2==0)
{
u/=2;
}
else if(u%2!=0)
{
u=u*3+1;
}
if(u==1)
{
break;
}
}
cout<<1<<" ";
for(int i=h-1;i>=0;i--)
{
cout<<opo[i]<<" ";
}
return 0;
}