#include<iostream>
using namespace std;
double math_max(double v1,double v2){
	if(v1>v2){
		return v1;
	}
	return v2;
}

double math_min(double v1,double v2){
	if(v1<v2){
		return v1;
	}
	return v2;
}
double math_abs(double v1){
	if(v1<0){
		return v1*-1;
	}
	return v1;
}
int main(){
	int n;
	cin>>n;
	for(int loop=0;loop<n;++loop){
		int d,max=0,min=0,tmp;
		cin>>d;
		cin>>tmp;
		for(int i=0;i<d-1;++i){
			int k;
			cin>>k;
			max=math_max(max,k-tmp);
			min=math_min(min,k-tmp);
			tmp=k;
		}
		if(min==102)min=0;
		cout<<max<<" "<<math_abs(min)<<endl;
	}
}