#include <stdio.h>

int main(void){
	int t,n,i,j;
	int prev,current;
	int upmax,downmax;
	scanf("%d",&t);
	for(i = 0; i < t; i++){
		scanf("%d",&n);
		current = -1;
		upmax = 0;
		downmax = 0;
		for(j = 0; j < n; j++){
			prev = current;
			scanf("%d",&current);
			if(prev != -1){
				if(prev > current){
					if(downmax < prev - current){
						downmax = prev - current;
					}
				}else{
					if(upmax < current - prev){
						upmax = current - prev;
					}
				}
			} 
		}
		printf("%d %d\n",upmax,downmax);
	}
	return 0;
}