#include <bits/stdc++.h> 
using namespace std; 
typedef long long int ll;	
ll c;
char text[20];
char set1[20];
char sex[20];
map<string,ll> oshi;
ll n;
void printAllKLengthRec(char set[], string prefix, 
									ll n1, ll k) 
{  
	// Base case: k is 0, 
	// print prefix 
	if (k == 0) 
	{ll i=0;
	map<string,string> c1;
	map<string,ll> b1;

		string y1="";
		ll  j=0;//RAM-RAM!!
		i=0;
		while(i<n)
		{
		    if(text[i]=='#')
		    {
		        sex[i]=prefix[j];
		        j++;
		    }
		    else
		    {
		       sex[i]=text[i];  
		    }
		    
		    //y1=y1+sex[i];
		    
		    
		    
		    i++;
		}
		  char ram1='a';
	 i=0;//RAM-RAM!!
		while(i<n)
		{
		char g=sex[i];
		string m1="";
		m1=m1+g;
		if(b1[m1]==0)
		{
		    b1[m1]=i+1;
		    string m2="";
		    m2=m2+ram1;
		    ram1++;
		    c1[m1]=m2;
		}
		else
		{
		    
		}
		
		
		
		
		
		    
		   
		    i++;
		}
			i=0;
		while(i<n)//RAM-RAM!!!
		{
		    char g=sex[i];
		    string g1="";
		    g1=g1+g;
		    string mf=c1[g1];
		    char tf=mf[0];
		    sex[i]=tf;y1=y1+sex[i];//RAM-RAM!!!//RAM-RAM!!!!
		    i++;
		}
		
		oshi[y1]++;
		return; 
	} 

	// One by one add all characters 
	// from set and recursively 
	// call for k equals to k-1 
	for (ll i = 0; i < n1; i++) 
	{ 
		string newPrefix; 
		
		// Next character of input added 
		newPrefix = prefix + set[i]; 
		
		// k is decreased, because 
		// we have added a new character 
		printAllKLengthRec(set, newPrefix, n1, k - 1); 
	} 

} 

void printAllKLength(char set[],ll k,ll n1) 
{ 
	printAllKLengthRec(set, "", n1, k); 
} 




void combinationUtil(ll arr[], ll data[],  
                    ll start, ll end,  
                    ll index, ll r);  
  

void printCombination(ll arr[], ll n1, ll r)  
{  
    // A temporary array to store 
    // all combination one by one  
    ll data[r];  
  
    // Print all combination using 
    // temprary array 'data[]'  
    combinationUtil(arr, data, 0, n1-1, 0, r);  
} 














void combinationUtil(ll arr[], ll data[], 
					ll start, ll end, 
					ll index, ll r) 
{ 

	if (index == r) 
	{   char ram = 'a';
	    ll i=0;
	    while(i<n)
	    {
	        
	        text[i]= '#' ; 
	        
	        i++;
	    }
	   
	
	
	
	
		for (ll j = 0; j < r; j++) 
		{
			//cout << data[j] << " "; 
		ll ju=data[j] - 1; //RAM-RAM!!!
		text[ju]=ram;
		    ram ++;
		    
		}
		
		printAllKLength(set1,n-r,r); 
		
		
		
		
		
		
		//cout<<"\n";
		
		
		//cout << endl; 
		return; 
	} 

	for (ll i = start; i <= end && 
		end - i + 1 >= r - index; i++) 
	{ 
		data[index] = arr[i]; 
		combinationUtil(arr, data, i+1, 
						end, index+1, r); 
	} 
}













// Driver Code 
int main() 
{ 
	
//	cout << "First Test" << endl; 
//	char set1[] = {'a', 'b'}; 
//	ll k = 3; 
//	printAllKLength(set1, k, 2); 
//	c=0;
//	cout << "Second Test\n"; 
//	char set2[] = {'a', 'b', 'c', 'd'}; 
//	k = 3; 
//	printAllKLength(set2, k, 4); 
//cout<<4096*210;
set1[0]='a';
set1[1]='b';
set1[2]='c';
set1[3]='d';
set1[4]='e';
set1[5]='f';
set1[6]='g';
set1[7]='h';
set1[8]='i';
set1[9]='j';
set1[10]='k';
set1[11]='l';
cin>>n;
if(n==1)
{
    cout<<"a";
}
else
{
    ll arr[n]={0};
    ll i=0;
    while(i<=n-1)
    {
        arr[i]=i+1;
        
        
        
        
        
        i++;
    }
    
    i=1; //number_of_distinct_guys....
    while(i<=n)
    {
    ll r = i; 
	printCombination(arr, n, r);
        
        
        
        
        i++;
    }
    
    //cout<<"lol";
map <string,ll> :: iterator itr;
for(itr = oshi.begin(); itr != oshi.end();++itr) 
    {   cout<<itr->first;
        cout<<"\n";
    }
    
    
    
    
}




    
} 
