getMinMax :: [Int] -> (Int,Int)
getMinMax (x:xs) = foldl judg (x,x) xs
  where judg :: (Int,Int) -> Int -> (Int,Int)
        judg (min,max) x
          | x < min = (x,max)
          | max < x = (min,x)
          | otherwise = (min,max)

main = do
  line <- getLine
  let
    dat = map read $ words line :: [Int]
    (min,max) = getMinMax dat
  putStrLn $ show min ++ " " ++ show max
