import Data.List

main = do
    all <- getContents
    mapM_ (putStrLn) (calc $ map read $ words all)


calc :: [Int] -> [String]
calc [] = []
calc (0:0:_) = []
calc xs =
    (unwords $ map show (sort (take 2 xs))) : calc (drop 2 xs)
