def dfs(n, str)
    if str.size == n
        puts str
        return
    end
    imax = str[-1].ord - "a".ord + 1
    for i in 0..imax
        dfs(n, str + (i + "a".ord).chr)
    end
end

n = gets.to_i
dfs(n, "a")