import qualified Data.ByteString.Char8 as BSC8
import qualified Control.Monad         as Monad
import qualified Control.Arrow         as Arrow
import qualified Data.Vector.Unboxed   as VU
import qualified Data.List             as List

getStringList :: IO [String]
getStringList = map BSC8.unpack . BSC8.words <$> BSC8.getLine
getMultiLineString :: Int -> IO [[String]]
getMultiLineString n = Monad.replicateM n getStringList

getI :: BSC8.ByteString -> Maybe (Int, BSC8.ByteString)
getI = fmap (Arrow.second BSC8.tail) . BSC8.readInt
getAB :: IO (Int, Int)
getAB = (\vec -> (vec VU.! 0, vec VU.! 1)) . VU.unfoldrN 2 getI <$> BSC8.getLine

main :: IO ()
main = do
  (n, l) <- getAB
  xs <- concat <$> getMultiLineString n
  putStrLn $ concat $ List.sort xs
