t = readline.to_i
t.times{
  n = readline.to_i
  h = readline.split.map(&:to_i)
  diff = []
  h[0..-2].zip(h[1..-1]){|a, b| diff << a-b}
  min_val, max_val = diff.minmax
  if min_val > 0
    min_val = 0
  end
  if max_val < 0
    max_val = 0
  end

  puts "#{-min_val} #{max_val}"    
}