#include<iostream>
using namespace std;

int main(){
int p,n,bef,aft,a;
scanf("%d",&p);
for(int q=0;q<p;q++){
scanf("%d",&n);
int up=0,down=0;
scanf("%d",&bef);
for(int i=1;i<n;i++){
scanf("%d",&aft);
a=aft-bef;
if(a > up){
	up=a;
}
if(a < down){
	down=a;
}
bef=aft;
}

cout<<up<<" "<<down*-1<<endl;
}
}