#include <stdio.h>

int main(void) {
	int d, i;
	scanf("%d", &d);
	for(i = 0; d > i; i++){
		int j,b, umax = 0, dmax = 0;
		int bdan = -1, dan;
		scanf("%d", &b);
		for(j = 0; b > j; j++){
			scanf("%d", &dan);
			if(bdan > -1) {
				if(dan > bdan){
					if(dan - bdan > umax) umax = dan-bdan;
				}
				else if(bdan - dan > dmax) dmax = bdan - dan;
			}
			bdan = dan;
		}
		printf("%d %d\n", umax, dmax);
	}
	return 0;
}