a=input() while a: print a a=3*a+1 if a%2*a>2 else a/2