using S=System.Console;class A{static void Main(){for(int x=int.Parse(S.ReadLine());;x=x%2>0?x*3+1:x/2){S.WriteLine(x);if(x<2)break;}}}