#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";
} 