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



import core.bitop;
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 )
{
	auto anss = new dchar[][]( 2L ^^ ( n - 1 ), n );
	foreach( b, ref ans; anss )
	{
		auto c = 'a' + b._popcnt;
		foreach( i; 0L .. n )
		{
			if( b & ( 1L << i ) )
			{
				ans[ $ - 1 - i ] = c;
				c--;
			}
			else
			{
				ans[ $ - 1 - i ] = 'a';
			}
		}
	}
	return anss.join( "\n" );
}
