#include<iostream>
using namespace std; //½Ç¹È²ÂÏë
int main()
{
int n;
cin>>n;
while(n!=1){
cout<<n<<endl;
if(n%2!=0){
n=n*3+1;
}else{
n/=2;
}
cout<<"1";