# Collatzin lukujono X = int(input()) while True: print(X, end="") if X == 1: break print(" ", end="") if X % 2 == 0: X = X // 2 else: X = 3 * X + 1 print()