t = gets.to_i
t.times {
    n = gets.to_i
    a = gets.split.map &:to_i
    up = a.each_cons(2).map{|x, y| [y - x, 0].max}.max
    down = a.each_cons(2).map{|x, y| [x - y, 0].max}.max
    puts "#{up} #{down}"
}