unittest
{
	assert( [ "1" ].parse.expand.solve == "a" );
	assert( [ "2" ].parse.expand.solve == "aa\nab" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	return tuple( n );
}

auto solve( long n )
{
	return solve2( n, 0, 0 ).join( "\n" );
}

dchar[][] solve2( long n, long i, long m )
{
	if( n == i ) return [ "".to!( dchar[] ) ];
	
	dchar[][] ss;
	foreach( d; 0L .. m + 1 )
	{
		foreach( t; solve2( n, i + 1, ( d == m ) ? m + 1 : m ) )
		{
			ss ~= cast( dchar )( 'a' + d ) ~ t;
		}
	}
	return ss;
}
