void main(){ int n,i;scanf("%d",&n);if(n==1)printf("%d\n",n);while(n!=1){ if(n%2==0)n=n/2;//else if(n==1)//break;else n=n*3+1;printf("%d\n",n);} }