
def PGEchternach():
    n = int(input("n? "))
    nombre = 1
    pasRestants = 3
    direction = 1
    for j in range(1, n+1):
        print(nombre, " ", sep="", end="")
        nombre += direction
        pasRestants -= 1
        if pasRestants == 0:
            direction = -direction
            pasRestants = (3 if direction == 1 else 2)
    print()

PGEchternach()