#include <bits/stdc++.h>
using namespace std;
vvector<string> ans;
int n;

void dfs(int curr , int last , string s){
	if(curr == n){
		ans.push_back(s);
		return ;
	}
	if(s[curr] == '-'){
		s[curr] = 'a'+last;
		last += 1;
	}
	for(int i = curr+1 ; i < n ; i += 1){
		s[i] = s[curr];
	}
	dfs(curr+1,last,s);
}

int main(){
	cin >> n;
	string s = "";
	for(int i = 0 ; i < n ; i += 1){
		s += '-';
	}
	dfs(0,0,s);
	sort(ans.begin(),ans,end());
	for(string i : ans){
		cout << i << '\n';
	}
}