#include <stdio.h>

int main(void)
{
	int t, n;
	int h1, h2;
	int i, j;
	int min, max;
	
	scanf("%d", &t);
	for (i = 0; i < t; i++){
		min = 1000;
		max = -1000;
		
		scanf("%d", &n);
		scanf("%d", &h1);
		for (j = 1; j < n; j++){
			scanf("%d", &h2);
			if (max < (h2 - h1)){
				max = h2 - h1;
			}
			if (min > (h2 - h1)){
				min = h2 - h1;
			}
			h1 = h2;
		}
		if (max < 0){
			max = 0;
		}
		if (min > 0){
			min = 0;
		}
		printf("%d %d\n", max, -min);
	}
	return (0);
}