import Data.List

main = interact $ unlines . map (show . sp . map read . words) . filter (elem ' ') . lines

sp = minimum . compress diff . sort
 where diff x y = abs (x-y)

compress _ [x] = [x]
compress op (x1:x2:xs) = op x1 x2 : compress op (x2:xs)