pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn f(v: &mut Vec<char>, dep: u8, n: u8) {
    if dep == n || v.len() == n as usize {
        let s: String = v.iter().collect();
        println!("{}", s);
    } else {
        for i in 0..dep + 1 {
            v.push(('a' as u8 + i) as char);
            let l = v.len();
            if v[l - 1] <= v[l - 2] {
                f(v, dep, n);
            } else {
                f(v, dep + 1, n);
            }
            v.pop();
        }
    }
}

fn main() {
    let n: u8 = read();

    let mut v: Vec<char> = vec!['a'];

    f(&mut v, 1, n);
}
