#include<stdio.h>
 
int main(){
	int a[100], i, n, max = 0, min = 0, t;
	scanf("%d", &t);
	for(int j = 0; j < t; j++){
		scanf("%d", &n);
		for(i = 0; i < n; i++){
			scanf("%d", &a[i]);
			if(i != 0){
				if(a[i] - a[i - 1] < min) min = a[i] - a[i - 1];
				if(a[i] - a[i - 1] > max) max = a[i] - a[i - 1];
			}
		}
		printf("%d %d\n", max, min * -1);
		max = 0;
		min = 0;
	}
	return 0;
}