-- Repetitive Processing - Swapping Two Numbers

import Control.Applicative

main :: IO ()
main = do
  xs <- map read . words <$> getContents
  let ys = loop xs
  mapM_ putStrLn $ [show a ++ " " ++ show b | (a, b) <- ys]
    where
      loop :: [Int] -> [(Int, Int)]
      loop (0 : 0 : _) = []
      loop [] = []
      loop (a : b : xs) = (if (a < b) then (a, b) else (b, a)) : loop xs

