gets.to_i.times do
  _ = gets
  diff_arr = []

  gets.split.map(&:to_i).each_cons(2) { |a, b| diff_arr << b - a }

  max = diff_arr.max
  min = diff_arr.min
  max_up = max < 0 ? 0 : max
  max_down = 0 < min ? 0 : min.abs

  puts "#{max_up} #{max_down}"
end