import Control.Monad
import Data.List
 
main = do
  n <- readLn
  xs <- replicateM n getLine
  putStr . sort $ foldl1 f xs
 
f [] _ = []
f (x:xs) ys
  | x `elem` ys = x : f xs (delete x ys)
  | otherwise = f xs ys