module Main
  ( main
  )
where

import           Control.Applicative
import           Control.Monad
import           Data.List
import           Data.Array
import           Data.Char

main = do
  n <- (read :: String -> Int) <$> getLine
  let base = ord 'a'
  ans <- foldM
    (\acc i -> do
      arr <- map ord . sort <$> getLine
      let counts = count arr [0] base
      return . map (uncurry min) $ zip counts acc
    )
    (take 26 [50, 50..])
    [1 .. n]
  putStrLn . concatMap (\(c, i) -> [ chr (base + c) | i <- [1 .. i] ]) $ zip
    [0 ..]
    ans

count :: [Int] -> [Int] -> Int -> [Int]
count (x : xs) (y : ys) n = if x == n
  then count xs (y + 1 : ys) n
  else count (x : xs) (0 : y : ys) (n + 1)
count [] y n = reverse y


