import Data.Array.Unboxed
import qualified Data.ByteString.Char8  as C
import Data.Char
import Data.List

main = C.interact $ sol . tail . C.lines

sol ss = C.pack $ g b
  where
  (a:as) = f <$> ss :: [UArray Char Int] 
  b = foldl' ((. assocs) . accum min) a as

f = array ('a','z') . fmap ((,) <$> C.head <*> C.length) . C.group . C.sort . C.filter isLetter

g = concatMap (\(c,n) -> replicate n c) . filter ((>0) . snd) . assocs