#include <stdio.h>

static int blocks[100];
static int block_num;
static int max_climb_up;
static int max_climb_down;

void init_parameter(){
    scanf("%d",&block_num);
    for (int i=0;i<block_num;i++)
        scanf("%d",blocks+i);
    max_climb_up=0;
    max_climb_down=0;
}

void run(){
    for (int i=0;i<block_num-1;i++){
        if (blocks[i]<blocks[i+1])
            max_climb_up=(blocks[i+1]-blocks[i])>max_climb_up?(blocks[i+1]-blocks[i]):max_climb_up;
        else if (blocks[i]>blocks[i+1])
            max_climb_down=(blocks[i]-blocks[i+1])>max_climb_down?(blocks[i]-blocks[i+1]):max_climb_down;
    }
    printf("%d %d\n",max_climb_up,max_climb_down);
}


int main() {
    int data_set_num=0;
    scanf("%d",&data_set_num);

    for (int i=0;i<data_set_num;i++){
        init_parameter();
        run();

    }

    return 0;
}
