use std::cmp;
use std::fmt::Debug;
use std::str::FromStr;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim()
        .split_whitespace()
        .map(|c| T::from_str(c).unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_as_string() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn list_std(n: usize, cur: &mut String, used_kind: u8) -> Vec<String> {
    if cur.len() == n {
        return vec![cur.clone()];
    }

    let mut res: Vec<String> = vec![];
    for k in 0..used_kind {
        cur.push(('a' as u8 + k) as char);
        let mut tmp = list_std(n, cur, used_kind + 1);
        res.append(&mut tmp);
        cur.pop();
    }

    res
}

fn main() {
    let n: usize = read_as_vec()[0];
    let mut ans = list_std(n, &mut String::from(""), 1);
    ans.sort();

    for s in ans {
        println!("{}", s);
    }
}
