import qualified Data.List.Split as S

main :: IO()
main = do
    (a:b:[]) <- readDatas
    reversePrint a b
    
reversePrint :: String -> String -> IO()
reversePrint "0" "0" = return ()
reversePrint a b = do
    putStrLn $ b ++ ' ':a
    (a:b:[]) <- readDatas
    reversePrint a b

readDatas :: IO ([String])
readDatas = do
    l <- getLine
    return $ S.splitOn " " l
