import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List
import Data.Array

main :: IO ()
main = do
  n <- getl read
  solve n <$> replicateM n getLine >>= putStrLn

solve :: Int -> [String] -> String
solve n ss = fra $ foldl1 coma (map toa ss)

toa :: String -> Array Char Int
toa xs = accumArray (+) 0 ('a', 'z') [(c,1)| c <- xs]

coma :: Array Char Int -> Array Char Int -> Array Char Int
coma aa ba = array ('a','z') [(c, min (aa ! c) (ba ! c)) | c <- ['a'..'z']]

fra :: Array Char Int -> String
fra aa = f . filter (\x -> snd x /= 0) . assocs $ aa
  where
    f [] = ""
    f ((x,i):xs) = replicate i x ++ f xs

getl :: (String -> a) -> IO a
getl f = f <$> getLine
