let alphabet = "abcdefghijklmnopqrstuvwxyz"
let () =
  Scanf.scanf "%d" @@ fun n ->
  let arr = Array.make n 0 in
  let rec dfs i j =
    if i = n then (
      Array.iter (fun c -> Printf.printf "%c" alphabet.[c]) arr;
      print_newline ()
    ) else (
      for c = 0 to j do
        arr.(i) <- c;
        dfs (i+1) (max (c+1) j);
      done;
    )
  in
  dfs 0 0
