import Data.List
import Data.List.Split
import Data.Char (isSpace)

trim :: String -> String
trim = f . f
  where
    f = reverse . dropWhile isSpace

calc :: Int -> Int -> (Int, Int)
calc a b = (min a b, max a b)

main :: IO ()
main = do
  s <- getContents
  let xs = splitOn "\n" $ trim s
  putStrLn $ intercalate "\n" [show a' ++ " " ++ show b' |
                               t <- xs,
                               let [a, b] = map read $ words t :: [Int],
                               a /= 0 && b /= 0,
                               let (a', b') = calc a b]