main=readLn>>=mapM print.c;c 1=[1];c n=n:c([n`div`2,3*n+1]!!(n`mod`2))