n = int(input())
a1 = list("abcdefghij")

n1 = 0
for i in range(n):
    n1 += (n-1)*(10**i)

for i in range(n1 + 1):
    b = list(map(int, list( str(i).zfill(n) )))
    c = [j < n for j in b]
    if not (all(c)):
        continue
    else:
        e = set()
        f = True
        g = 0
        for j in b:
            if j not in e and g == j:
                e.add(g)
                g += 1
            elif j in e:
                continue
            else:
                f = False
                break
        if f:
            d = [a1[j] for j in b]
            print("".join(d))