#include<bits/stdc++.h>
using namespace std;

#define REP(i,a,b) for(int i = (a) ; i < (int)(b) ; ++i )
#define _REP(i,a,b) for(int i = (a) ; i <= (int)(b) ; ++i )
#define UREP(i,u) for(int i = p[(u)] ; i + 1 ; i = edge[i].next)
//iterator: for(int u:x),x is container
#define x(p) (p).first
#define y(p) (p).second
#define mp(x,y) make_pair((x), (y))
#define ll long long
#define inf 0x3f3f3f3f
#define mem(x,v) memset((x), (v), sizeof (x))
#define _ri1(x) scanf("%d", &(x))
#define _ri2(x,y) scanf("%d%d", &(x), &(y))
#define _ri3(x,y,z) scanf("%d%d%d", &(x), &(y), &(z))
#define _ri4(a,b,c,d) scanf("%d%d%d%d", &(a), &(b), &(c), &(d))
#define _pi1(a) printf("%d\n", (a))
#define _pi2(a,b) printf("%d%d\n", (a), (b))

#ifdef kinesis
mt19937 rnd(228);
#else
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

const int maxn = 1e3 + 5;

struct node
{
    char s[15];
    bool operator<(const node&rhs)
    {
        return strcmp(s,rhs.s) < 0;
    }
}N[maxn];

int n,cnt;

int main()
{
    //#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin);
    //#endif // ONLINE_JUDGE

    int a[15];
    while(_ri1(n)==1){
        cnt = 0;
        for(int i=n;(i>=1);i--){
            int j,k;
            for(j=1;j<=i;j++) a[j] = 0;
            for(k=j;k<=n;k++) a[k] = 1;
            do{
                int flag = 0;
                _REP(p,1,n){
                    N[cnt].s[p-1] = 'a' + a[p];
                }
                cnt++;
            }while(next_permutation(a+2,a+n+1));
        }
        sort(N,N+cnt);
        REP(i,0,cnt){
            printf("%s\n",N[i].s);
        }
        //printf("%d\n",cnt);
    }

    return 0;
}
