N = int(input())
lst = ['a','b','c','d','e','f','g','h','i','j']

numsList = list()
memo = list()

def dp(words,nums,c):
    if nums in memo:
        return
    if len(words) == N:
        if nums not in numsList:
            print(words)
            numsList.append(nums)
        return
    for v in range(N):
        if lst[v] not in words:
            dp(words+lst[v],nums + str(c + 1),c+1)
        else:
            dp(words+lst[v],nums + nums[words.find(lst[v])],c)
    memo.append(nums)
dp('a','0',0)