#include <cstdio>
#include <iostream>

using namespace std;

int main(void)
{
	int t, n;
	int array[128];
	
	cin >> t;
	for (int c = 0; c < t; c++){
		cin >> n;
		
		int up_max = 0, dn_max = 0;
		for (int i = 0; i < n; i++){
			cin >> array[i];
			
			if (i > 0){
				if (up_max < array[i] - array[i-1]){
					up_max = array[i] - array[i-1];
				}
				if (dn_max < array[i-1] - array[i]){
					dn_max = array[i-1] - array[i];
				}
			}
		}
		
		cout << up_max << " " << dn_max << endl;
	}
	
	return (0);
}