for t in range(eval(input())):

    up = 0; down = 0;

    n = eval(input())

    h = list(map(int, input().split()))

    print(max([0]+[h[i+1]-h[i] for i in range(n-1)]), max([0]+[h[i]-h[i+1] for i in range(n-1)]))
for t in range(eval(input())):

    n = eval(input())

    h = list(map(int, input().split()))

    print(max(0, max(h[i+1]-h[i] for i in range(n-1))), max(0, max(h[i]-h[i+1] for i in range(n-1))))
for t in range(eval(input())):
    up = 0
    down = 0
    n = eval(input())
    h = list(map(int, input().split()))
    print(
        max([0] + [h[i + 1] - h[i] for i in range(n - 1)]),
        max([0] + [h[i] - h[i + 1] for i in range(n - 1)]),
    )

for t in range(eval(input())):
    n = eval(input())
    h = list(map(int, input().split()))
    print(
        max(0, max(h[i + 1] - h[i] for i in range(n - 1))),
        max(0, max(h[i] - h[i + 1] for i in range(n - 1))),
    )

-    up = 0 -    down = 0 -        max([0] + [h[i + 1] - h[i] for i in range(n - 1)]), -        max([0] + [h[i] - h[i + 1] for i in range(n - 1)]), +        max(0, max(h[i + 1] - h[i] for i in range(n - 1))), +        max(0, max(h[i] - h[i + 1] for i in range(n - 1))),