def deep(d,i,s)
  if d == $n
    puts s.join
    return 
  end
  (0..i).each do |j|
    s.push($t[j])
    deep(d+1,j+1,s)
    s.pop
  end
end
$t = "abcdefghijkllm".split("")
$n = gets.to_i
deep(0,0,[])
