use proconio::input;

fn main() {
    input! {
        n: usize,
    }
    let mut ret: Vec<String> = Vec::new();
    let mut v: Vec<char> = vec!['a'; 1];
    dfs(n, &mut v, &mut ret);
    for s in ret.iter() {
        println!("{}", s);
    }
}

fn dfs(n: usize, v: &mut Vec<char>, ret: &mut Vec<String>) {
    if v.len() == n {
        let s = v.iter().collect::<String>();
        ret.push(s);
        return;
    }

    let last_ch = v[v.len() - 1] as u8;
    for ch_u8 in ('a' as u8)..=last_ch + 1 {
        let ch = ch_u8 as char;
        v.push(ch);
        dfs(n, v, ret);
        v.pop();
    }
}
