import Data.List
import Data.Ord
import Data.Maybe

main = putStrLn . solve . drop 1 . lines =<< getContents

solve :: [String] -> String
solve ss = concat $ map (\c -> flip replicate c . minimum $ map (maybe 0 length . find ((==c) . head)) ss') ['a'..'z']
    where ss' = map (group . sort) . sortBy (comparing length) $ ss
