#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <stack>
#include <vector>
#include <math.h>
#include <queue>

using namespace std;

int main(){

	int N,upMAX,downMAX,num,tmp,pre;

	scanf("%d",&N);

	for(int i = 0; i < N; i++){
		scanf("%d",&num);
		pre = -1;
		upMAX = 0,downMAX = 0;
		for(int k = 0; k < num; k++){
			scanf("%d",&tmp);
			if(pre == -1){
				//Do nothing
			}else if(pre > tmp){
				downMAX = max(downMAX,pre-tmp);
			}else if(pre < tmp){
				upMAX = max(upMAX,tmp-pre);
			}
			pre = tmp;
		}
		printf("%d %d\n",upMAX,downMAX);
	}

	return 0;
}