#include <stdio.h>
#define SIZE 100
int main(void)
{
	int t, n, h, hh, up, dw;
	int i, j;

	scanf("%d", &t);
	for (i = 0; i < t; i++) {
		scanf("%d", &n);
		scanf("%d", &hh);
		up = 0; dw = 0;
		for (j = 1; j < n; j++) {
			scanf("%d", &h);
			if (hh < h && up < h - hh)
				up = h - hh; 
			if (hh > h && dw < hh - h)
				dw = hh - h;
			hh = h;
		}
		printf("%d %d\n", up, dw);
	}
	return 0;
}
			