t = gets.to_i

t.times {
  n = gets.to_i

  ansA = 0
  ansB = 0
  beforeh = 0

  block = gets.split(" ")

  block.each_with_index do |item, index|

    h = item.to_i

    if index == 0 
      beforeh = h
      next
    end

    if (h - beforeh > ansA)
      ansA = h - beforeh
    end
    if (beforeh - h > ansB)
      ansB = beforeh - h
    end

    beforeh = h

  end

  print "#{ansA} #{ansB}\n"
}