import std.stdio;
import std.algorithm;

void dfs(char[] s, char mx, uint n) {
	if (s.length >= n) {
		writeln(s);
		return;
	}

	for (char c = 'a';c <= mx + 1;++c) {
		auto t = s.dup;
		t ~= c;
		dfs(t, max(mx, c), n);
	}
}

void main() {
	uint n;

	readf(" %s", &n);

	dfs("".dup, 'a' - 1, n);
}
