f :: Int -> [String]
f i = if i == 0 then [""] else (:) <$> take 10 (enumFrom 'a') <*> f (i-1)

check :: String -> Bool
check = go []
    where
        go used [] = True
        go used (x:xs) = if elem x ('a' : used ++ map succ used) then go (x:used) xs else False

main = do
    n <- read <$> getLine
    let l = f n
    mapM_ (\s -> if check s then putStrLn s else return ()) l