#include <stdio.h>

int main(void) {
	int i,ii,n,ds,hmb,now,next,min,max,dat[200]={0};
	scanf("%d",&ds);
		for (i = 1;i <= ds;i++){
			scanf("%d",&hmb);
				for (ii = 0;ii < hmb;ii++){
					scanf("%d",&n);
					dat[ii] = n;
				}
				max = 0;
				min = 0;
				for (ii = 0;ii < hmb - 1;ii++){
					now = dat[ii];
					next = dat[ii + 1];
					if (max < next - now){
						max = next - now;
					}
					if (min > next - now){
						min = next - now;
					}
				}
			printf("%d %d\n",max,-min);
		}
	return 0;
}
//aoj 2100