import Data.List
import qualified Data.Map as M

main :: IO ()
main = do
    _ <- getLine
    ss <- lines <$> getContents
    putStrLn . solve $ ss

count :: String -> M.Map Char Int
count = foldl' (\acc cs -> M.insert (head cs) (length cs) acc) base
        . group . sort
    where
        base = M.fromList $ zip ['a'..'z'] (repeat 0)

render :: M.Map Char Int -> String
render = M.foldrWithKey (\k v a -> (replicate v k) ++ a) "" 

solve :: [String] -> String
solve = render . M.unionsWith min . map count
