a = int(input("write number")) while True: print(a) if a % 2 == 0: a = a // 2 else: a = a * 3 + 1 if a == 1: print(a) break