import Control.Applicative
import Control.Monad
import Data.Array
import Data.List (foldl')

main = do
  n <- readLn
  replicateM_ n main'

main' = do
  n <- (read :: String -> Int) <$> getLine
  s <-  map (read :: String -> Int) . words <$> getLine
  let arr = listArray (1,n) s
  let [a,b] = mini_and_max n arr
  putStrLn $ show a ++ " " ++ show (-b)

mini_and_max n arr =
  foldl' test [0,0] [2..n]
    where
      test [a,b] n =
        [max a ((arr ! n)- arr ! (n-1)),
         min b ((arr ! n)- arr ! (n-1))]