-- | Main entry point to the application.
module Main where

import Control.Applicative
import Control.Monad
import Data.List
import Debug.Trace
import Text.Printf

rInt :: String -> Int
rInt str = read str :: Int

tupleFromLine :: String -> (Int, Int)
tupleFromLine str =
    case words str of
        [x, y] -> (rInt x, rInt y)
        
sortTuple (x, y)
    | x <= y = (x, y)
    | x > y = (y, x)

-- | The main entry point.
main :: IO ()
main = do
    --[w, h, x, y, r] <- (map rInt . words) <$> getLine
    s <- getContents
    let lst = map tupleFromLine $ lines s
    forM_ [0..(length lst - 2)] $ \i -> do
        printf "%d %d\n" (fst $ sortTuple (lst !! i)) (snd $ sortTuple (lst !! i))