main :: IO ()
main = do
  ls1 <- getLine
  ls2 <- getLine
  let t1 = makeTuple (tail (map read (words ls1)))
      t2 = makeTuple (tail (map read (words ls2)))
  putStrLn $ solve t1 t2

makeTuple :: [Int] -> [(Int,Int)]
makeTuple [] = []
makeTuple (h:m:r) = (h,m):(makeTuple r)

solve :: [(Int,Int)] -> [(Int,Int)] -> String
solve t1 t2 = format (sort (t1 ++ t2))
  where
    sort :: [(Int,Int)] -> [(Int,Int)]
    sort [] = []
    sort ((h,m):r) = (sort lower) ++ [(h,m)] ++ (sort higher)
      where
        lower = filter (\(a,b) -> (a < h) || ((a == h) && b < m)) r
        higher = filter (\(a,b) -> (a > h) || ((a == h) && b > m)) r

    format :: [(Int,Int)] -> String
    format [] = []
    format [(a,b)] = deform (a,b)
    format ((a,b):r) = (deform (a,b)) ++ " " ++ (format r)

    deform :: (Int,Int) -> String
    deform (a,b) = (show a) ++ ":" ++ (replicate (2 - length (show b)) '0') ++ (show b)