use std::io::{self, BufRead, Write}; const ABC: [char; 26] = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']; const START: [char; 25] = ['a','b','c','d','e','f','g','h','i','j','k','l','m','o','p','q','r','s','t','u','v','w','x','y','z']; const END: [char; 25] = ['b','c','d','e','f','g','h','i','j','k','l','m','o','p','q','r','s','t','u','v','w','x','y','z','a']; fn get_lines() -> Vec { let stdin = io::stdin(); let lines: Vec = stdin.lock().lines().map(|l| l.unwrap()).collect(); return lines; } fn main(){ let stdout = io::stdout(); let mut bufout = io::BufWriter::new(stdout.lock()); let s = &get_lines(); let n = s[0].parse::().unwrap(); if n == 1 { writeln!(bufout, "n").unwrap(); return; } let mut i = 1; for (s, e) in START.iter().zip(END.iter()) { if i == n { writeln!(bufout, "{}n", s).unwrap(); return; } writeln!(bufout, "{}{}", s, e).unwrap(); i += 1; } let mut j = 1; while j <= 18 { let mut t = String::with_capacity(j + 2); for x in 0..j { let mut k = 0; for _ in 0..26 { for (s, e) in START.iter().zip(END.iter()) { if i == n { writeln!(bufout, "{}n", s).unwrap(); return; } t.clear(); t.push(*s); for _ in 0..x { if k == 26 { k = 0; } t.push(ABC[k]); k += 1; } for _ in 0..x { if k == 26 { k = 0; } k += 1; } if k == 26 { k = 0; } let mut l = k; for _ in 0..(j - x) { if l == 26 { l = 0; } t.push(ABC[l]); l += 1; } k += 1; t.push(*e); writeln!(bufout, "{}", t).unwrap(); i += 1; } } } j += 1; } println!("{}", i) }