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