#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

int main(void){
	int cases;
	
	cin >> cases;
	while(cases--){
		int n;
		cin >> n;
		int a[n];
		int down = 0, up=0;
		for(int i=0;i<n;i++) cin >> a[i];
		for(int i=1;i<n;i++){
			if(a[i] > a[i-1]){
				up = max(up, a[i] - a[i-1]);
			}else{
				down = max(down, a[i-1] - a[i]);
			}
		}
		cout << up << " " << down << endl;
	}
}