module app;

import core.bitop;

import std.algorithm;
import std.array;
import std.bigint;
import std.container.rbtree;
import std.conv;
import std.stdio;
import std.string;
import std.traits;

struct Input
{
	int n;
}

void parseInput(T)(out Input input, T file)
{
	with (file) with (input)
	{
		n = readln().strip().to!int;
	}
}

auto main2(Input* input)
{
	with (input)
	{
		int[] keta;
        keta.length = n;
        keta[] = 0;

        LOOP:
        while (true)
        {
            foreach (i; keta)
            {
                char c = cast(char)('a' + i);
                writef("%c", c);
            }
            write("\n");

            for (int i = n - 1; i >= 0; i--)
            {
                if (keta[i] < i)
                {
                    keta[i]++;
                    foreach (j; keta)
                    {
                        if (j == keta[i] - 1)
                            continue LOOP;
                    }
                }
                keta[i] = 0;
            }

            break;
        }
	}
}

alias retType = ReturnType!main2;

void printResult(T)(T result)
{
	static if (isFloatingPoint!T) writefln("%f", result);
	else writeln(result);
}

void main()
{
	Input input = void;
	parseInput(input, stdin);
	static if (is(retType == void))
		main2(&input);
	else
	{
		auto result = main2(&input);
		printResult(result);
	}
}
