n=int(input()) t=n ls=[] if n==1: print(1) while n!=1: if n%2!=0: n=n*3+1 ls.append(n) else: n=n/2 ls.append(n) l=len(ls) for i in range(l-1,0,-1): print("{:.0f}".format(ls[i]),end=" ") print("{:.0f} {:.0f}".format(ls[0],t),end=" ")