<?php
$n = (int)trim(fgets(STDIN));

$list = [["a"]];
if ($n === 1) {
	echo implode($list[0]);
	exit();
}

$result = [];
dfs([0], 0);

$alpha = array_slice(range("a", "z"), 0, $n);
$strings = [];
foreach ($result as $array) {
	$str = array_reduce($array, function($str, $idx) use($alpha){
		return $str .= $alpha[$idx];
	}, "");
	$strings[] = $str;
}
echo implode(PHP_EOL, $strings);

function dfs($idx_array, $depth){
	$depth += 1;
	global $n;
	global $result;
	$last = min($n-1, $idx_array[count($idx_array) -1]+1, 3);
	$tmp = $idx_array;
	for ($i=0; $i <= $last; $i++) { 
		array_push($idx_array, $i);
		if ($depth === $n-1) {
			$result[] = $idx_array;
		} else {
			dfs($idx_array, $depth);
		}
		$idx_array = $tmp;
	}
}