t = gets.to_i
t.times{
  n = gets.to_i
  h = gets.split.map(&:to_i)
  d = []
  for x in 0...(n-1)
    d += [h[x+1]-h[x]]
  end
  d_max = d.max > 0 ? d.max.abs : 0
  d_min = d.min < 0 ? d.min.abs : 0
  puts [d_max, d_min].join(" ")
}