import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

import scala.annotation.tailrec
import scala.collection.mutable

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val n = in.readLine().toInt

    implicit object TupleOrdering extends Ordering[(Int, Char, Array[Char])] {
      override def compare(x: (Int, Char, Array[Char]), y: (Int, Char, Array[Char])): Int = {
        @tailrec
        def inner(i: Int, x: Array[Char], y: Array[Char]): Int = {
          if (x(i) == y(i)) {
            inner(i + 1, x, y)
          } else {
            y(i) - x(i)
          }
        }

        inner(0, x._3, y._3)
      }
    }

    val queue = mutable.PriorityQueue.empty[(Int, Char, Array[Char])]

    queue.enqueue((n, 'a', Array.fill(n)(0)))

    while (queue.nonEmpty) {
      val (rest, ch, chars) = queue.dequeue()

      if (rest == 0) {
        out.println(chars.mkString(""))
      } else {
        var indices = chars.zipWithIndex.filter(_._1 == 0).map(_._2)
        chars(indices.head) = ch

        indices = indices.tail
        (0 until (1 << indices.length)).foreach { pattern =>
          val newChars = chars.clone()
          var count = 1
          indices.zipWithIndex.foreach {
            case (index, i) =>
              if ((pattern >> i & 1) == 0) {
                newChars(index) = ch
                count += 1
              }
          }
          queue.enqueue((rest - count, (ch + 1).toChar, newChars))
        }
      }
    }

    out.flush()
  }
}
