#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
#define INF 100000000
int max(int a,int b){
	if(a>b){
		return a;
	}else{
		return b;
	}
}

int main(){
	int set;
	cin>>set;
	for(;set>0;set--){
		int n,up=0,down=0,a,b;
		cin>>n;
		cin>>a;
		for(int i=1;i<n;i++){
			cin>>b;
			if(a<b){
				up=max(up,b-a);
			}else{
				down=max(down,a-b);
			}
			a=b;
		}
		cout<<up<<' '<<down<<endl;
	}
	return 0;
}	