n = gets.to_i

str = "a" * n
ans = []

while str[0] == "a"
    ans << str if catch {|tag1|
        ans.each do |s|
            h = {}

            next if catch {|tag2|
                str.each_char.with_index do |c, i|
                    if h[s[i]].nil?
                        h[s[i]] = c
                    elsif h[s[i]] != c
                        throw(tag2, true)
                    end
                end
                false
            }

            throw(tag1, false)
        end
        true
    }

    str = str.next
end

puts ans