
n = gets.to_i

a = "a"
s = a*n

l = s.length-1

array = []
for i in 0..n do
    array.push(("a".bytes[0]+i).chr)
end

array = array.repeated_permutation(n).to_a

for i in 0..array.length-1 do
    array[i] = array[i].join("")
end

def check_string (one, two)

    check = false
    for i in 0..one.length-1 do
        for j in 0..one.length-1 do
            if (one[i] == one[j] && two[i] == two[j]) || (one[i] != one[j] && two[i] != two[j])then
                check = true
            else
                return false
            end
        end
    end

    return check
end

puts check_string(array[0],array[4])

l = array.length-1
for i in 0..l do
    for j in i+1..l do
        if check_string(array[i],array[j]) then
            array[j] = nil
        end
    end
    array.compact!
    l = array.length-1
end

puts array