#include<stdio.h>

int main(void)
{
    int N , n , i , j , h , max , min ;
    int a[101] ;

    scanf("%d",&N);
    for(i=0;i<N;i++){

        for(j=0;j<101;j++){
            a[j]=0;
        }
        max = 0 ;
        min = 0 ;

        scanf("%d",&n);
        for(j=1;j<=n;j++){
            scanf("%d",&h);
            a[j] = h ;
            if((max < (a[j] - a[j-1])) && j != 1){
                max = a[j] - a[j-1] ;
            }
            if(min < (a[j-1] - a[j])){
                min = a[j-1] - a[j] ;
            }
        }
        printf("%d %d\n",max,min);
    }
    return 0;
}