System.in.withReader{ n=Integer.parseInt(it.readLine()) println n while(n!=1){ if(n%2==1){ n=3*n+1 } else { n=(int)(n/2) } println n } }