import Data.List (nub)

kinds :: String -> Int
kinds = length . nub

normalStrings :: Int -> [String]
normalStrings 1 = ["a"]
normalStrings n
  | n <= 0 = error "normalStrings: non-positive integer"
  | otherwise =
      let prefixes = normalStrings (n-1)
      in
      flip concatMap prefixes $ \prefix ->
        map (\c -> prefix ++ [c]) $ take (kinds prefix + 1) ['a'..]

main :: IO ()
main = do
  n <- readLn
  mapM_ putStrLn $ normalStrings n
