using C=System.Console;class M{static void Main(){for(int i=int.Parse(C.ReadLine());i>0;i=i<2?0:i%2>0?i*3+1:i/2)C.WriteLine(i);}}