solve :: [Int] -> [String]
solve (x:y:xs)
  | x == 0 && y == 0 = []
  | otherwise = (show (min x y) ++ " " ++ show (max x y)) : solve xs

main = getContents >>= mapM_ putStrLn . solve . (++[1,1]) . map read . words