length = int(input())
nums = []

def f(level,already):
    if level >= length:
        nums.append(already)
        return
    else:
        for i in range(0, max(already) + 2):
            f(level + 1, already + [i])

f(1,[0])
for n in nums:
    print("".join(list(map(str, n))))