#include <iostream>
#include <stdlib.h>

using namespace std;

int main(int argc, char **argv)
{
	int n, t, tmp, st;
	int *array;
	cin >> t;
	
	for(int i = 0, up = 0, down = 0; i < t; i++, up = 0, down = 0){
		cin >> n;
		cin >> st;
		for(int j = 1; j < n; j++){
			cin >> tmp;
			st -= tmp;
			
			if(st < 0 && up > st){
				up = st;
			} else if(down < st){
				down = st;
			}
			
			st = tmp;
		}
		
		cout << (-up) << " " << down << endl;
	}
	
	return 0;
}