def chg(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

N = int(input())
li = list("abcdefghij")

for i in range(10**5):
    mm = str(chg(i,N)).zfill(N)
    cnt = 0
    for j in range(N):
        a = int(mm[j])
        if a<=cnt:
            continue
        elif a-1==cnt:
            cnt += 1
            continue
        break
    else:
        for j in range(N):
            print(li[int(mm[j])],end="")
        print()
    print(mm)



