#include<stdio.h>
int main(){
int n,m,a[200],up,down,i;
scanf("%d",&n);
while(n-->0){
up=0;
down=0;
scanf("%d",&m);
for(i=0;i<m-1;i++)
scanf("%d ",&a[i]);
scanf("%d",&a[m-1]);
for(i=0;i<m-1;i++){
if(a[i]<a[i+1]){
if(a[i+1]-a[i]>up)
up=a[i+1]-a[i];
}
else if(a[i]>a[i+1]){
if(a[i]-a[i+1]>down)
down=a[i]-a[i+1];
}
}
printf("%d %d\n",up,down);
}
return 0;
}