import Data.List

sumup [] = []
sumup x@(a:[]) = x

sumup (a:b:xs) =
  if a == b
  then sumup $ sort ((a+1):xs)
  else a:(sumup (b:xs))

ans i =
  let s = sort $ map (\ (a:b:_) -> a+b) i
      r = sumup s
  in
    r

main = do
  _ <- getLine
  c <- getContents
  let i = map (map read) $ map words $ lines c :: [[Int]]
      o = ans i
  mapM_ putStrLn $ map (\ x -> (show x) ++ " 0") o
  