#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define x first
#define y second
#define pb push_back
#define pf push_front
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

void solve()
{
	int n;
	cin >> n;
	int cnt = 1;
	vector<string> ans;
	string s="";
	int ite[10]={1,2,3,4,5,6,7,8,9,10};
	rep(i, n) s.push_back('a');
	if (n == 1)
	{
		rep(i1, 1)
		{
			string t = s;
			t[0] += i1;
			ans.push_back(t);
			t=s;
		}
	}
	else if (n == 2)
	{
		rep(i1, 1)
		{
			string t = s;
			
			rep(i2, 2)
			{
				t[0] += i1;
				t[1] += i2;
				ans.push_back(t);
				t=s;
			}
		}
	}else if(n==3){
		rep(i1, 1)
		{
			string t = s;
			
			rep(i2, 2)
			{	
				rep(i3,3){
					t[0] += i1;
					t[1] += i2;
					t[2]+=i3;
					ans.push_back(t);
					t=s;
				}

			}
		}
	}else if(n==4){
		rep(i, 1)
		{
			string t = s;
			
			rep(i2, 2)
			{
				
				rep(i3,3){
					
					rep(i4,4){
						t[0]+=i;
						t[1]+=i2;
						t[2]+=i3;
						t[3]+=i4;
						ans.push_back(t);
						t=s;
					}	
				}

			}
		}
	}else if(n==5){
		rep(i, 1)
		{
			string t = s;
			
			rep(i2, 2)
			{
				
				rep(i3,3){
					
					rep(i4,4){
						
						rep(i5,5){
							t[0]+=i;
						t[1]+=i2;
						t[2]+=i3;
						t[3]+=i4;
							t[4]+=i5;
							ans.push_back(t);
							t=s;
						}
						
					}	
				}

			}
		}
	}else if(n==6){
		rep(i, 1)
		{
			string t = s;
			//t[0] += i;
			rep(i2, 2)
			{
				//t[1] += i2;
				rep(i3,3){
					//t[2]+=i3;
					rep(i4,4){
						//t[3]+=i4;
						rep(i5,5){
							//t[4]+=i5;
							rep(i6,6){
								t[0]+=i;
						t[1]+=i2;
						t[2]+=i3;
						t[3]+=i4;
							t[4]+=i5;
								t[5]+=i6;
							ans.push_back(t);
							t=s;
							}
						}
						
					}	
				}

			}
		}
	}else if(n==7){
		rep(i, 1)
		{
			string t = s;
			//t[0] += i;
			rep(i2, 2)
			{
				//t[1] += i2;
				rep(i3,3){
					//t[2]+=i3;
					rep(i4,4){
						//t[3]+=i4;
						rep(i5,5){
							//t[4]+=i5;
							rep(i6,6){
								//t[5]+=i6;
								rep(i7,7){
											t[0]+=i;
						t[1]+=i2;
						t[2]+=i3;
						t[3]+=i4;
							t[4]+=i5;
								t[5]+=i6;
									t[6]+=i7;
									ans.push_back(t);
									t=s;
								}
							
							}
						}
						
					}	
				}

			}
		}
	}else if(n==8){
		rep(i, 1)
		{
			string t = s;
			
			rep(i2, 2)
			{
				
				rep(i3,3){
					
					rep(i4,4){
						//t[3]+=i4;
						rep(i5,5){
						//	t[4]+=i5;
							rep(i6,6){
						//		t[5]+=i6;
								rep(i7,7){
						//			t[6]+=i7;
									rep(i8,8){
													t[0]+=i;
						t[1]+=i2;
						t[2]+=i3;
						t[3]+=i4;
							t[4]+=i5;
								t[5]+=i6;
									t[6]+=i7;
										t[7]+=i8;
										ans.push_back(t);
										t=s;
									}
									
								}
							
							}
						}
						
					}	
				}

			}
		}
	}else if(n==9){
		rep(i, 1)
		{
			string t = s;
			//t[0] += i;
			rep(i2, 2)
			{
			//	t[1] += i2;
				rep(i3,3){
			//		t[2]+=i3;
					rep(i4,4){
			//			t[3]+=i4;
						rep(i5,5){
			//				t[4]+=i5;
							rep(i6,6){
			//					t[5]+=i6;
								rep(i7,7){
			//						t[6]+=i7;
									rep(i8,8){
			//							t[7]+=i8;
										rep(i9,9){
																	t[0]+=i;
						t[1]+=i2;
						t[2]+=i3;
						t[3]+=i4;
							t[4]+=i5;
								t[5]+=i6;
									t[6]+=i7;
										t[7]+=i8;
											t[8]+=i9;
											ans.push_back(t);
											t=s;
										}
										
									}
									
								}
							
							}
						}
						
					}	
				}

			}
		}
	}else{
		rep(i, 1)
		{
			string t = s;
			//t[0] += i;
			rep(i2, 2)
			{
			//	t[1] += i2;
				rep(i3,3){
			//		t[2]+=i3;
					rep(i4,4){
			//			t[3]+=i4;
						rep(i5,5){
			//				t[4]+=i5;
							rep(i6,6){
			//					t[5]+=i6;
								rep(i7,7){
			//						t[6]+=i7;
									rep(i8,8){
			//							t[7]+=i8;
										rep(i9,9){
			//								t[8]+=i9;
											rep(i10,10){
																							t[0]+=i;
						t[1]+=i2;
						t[2]+=i3;
						t[3]+=i4;
							t[4]+=i5;
								t[5]+=i6;
									t[6]+=i7;
										t[7]+=i8;
											t[8]+=i9;
												t[9]+=i10;
												ans.push_back(t);
												t=s;
											}
											
										}
										
									}
									
								}
							
							}
						}
						
					}	
				}

			}
		}
	}
	//rep(i,ans.size())cout<<ans[i]<<endl;
	map<string,int>used;
	vector<string>aa;
	rep(i,ans.size()){
		char min='a';
		rep(j,n){
			if(ans[i][j]>min){
				char k=ans[i][j];
				rep(r,n){
					if(ans[i][r]==k){
						ans[i][r]=min+1;
					}
				}
				min++;
			}
		}
		if(used[ans[i]]){

		}else{
			used[ans[i]]++;
			aa.push_back(ans[i]);
		}
	}
	rep(i,aa.size()){
		cout<<aa[i]<<endl;
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
}


Measured memory_bytes: 220768