#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use std::mem::swap;

#[fastout]
fn main() {
    input! {
    n: usize
    }
    let mut words = vec![vec!['a']];
    for i in 1..n {
        let mut prev = vec![];
        swap(&mut words, &mut prev);
        for w in &prev {
            for c in 97..w[i - 1] as u8 + 2 {
                let mut tmp = w.clone();
                tmp.push(c as char);
                words.push(tmp);
            }
        }
    }
    let mut ans: Vec<String> = words.iter().map(|x| x.into_iter().collect::<String>()).collect();
    ans.sort();
    for i in ans{
        println!("{}", i);
    }
}
