#include <stdio.h>

int main(){
	int upmax,downmax;
	int pre,now;
	int t,n,i;
	scanf("%d",&t);
	for(;t>0;t--){
		scanf("%d",&n);
		upmax = 0;
		downmax = 0;
		for(i=0;i<n;i++){
			scanf("%d",&now);
			if(i==0){
				pre = now;
				continue;
			}
			if((now>pre)&&(upmax<(now-pre))){
				upmax = now-pre;
			}
			if((now<pre)&&(downmax<(pre-now))){
				downmax = pre-now;
			}
			pre = now;
		}
		printf("%d %d\n",upmax,downmax);
	}
	return 0;
}