import Control.Monad
import Data.List
main=do
 n<-readLn;s<-replicateM n (sort<$>getLine)
 putStrLn(f (head s) (tail s) [])
  where f x [] _ = x
        f _ ([]:s) u = f (reverse u) s []
        f [] (_:s) u = f (reverse u) s []
        f (c:x) ((d:t):s) u |c==d = f x (t:s) (d:u)
                            |c<d  = f x ((d:t):s) u
                            |c>d  = f (c:x) (t:s) u