t = gets.to_i
t.times do
  n = gets.to_i
  x = gets.chomp.split(" ")
  a = Array.new(10)
  for i in 0..n-1
    a[i] = x[i].to_i
  end
  max=0;min=0
  for i in 1..n-1
    z = a[i] - a[i-1]
    max=z if z>=0 && max<z
    min=z if z<0 && min>z
  end
  print(max," ",-min,"\n")
end
