let n = Scanf.sscanf (read_line ()) "%d" @@ fun n -> n

let rec loop s mx =
  if String.length s = n then print_endline s
  else for i = (int_of_char 'a') to mx do
    loop (s ^ (Char.escaped @@ char_of_int i)) (if i = mx then mx + 1 else mx)
  done

let () = loop "" (int_of_char 'a')