#include<iostream>
#include<algorithm>
using namespace std;
int a[10000000], n, maxup, maxdown, p;
int main() {
	cin >> p;
	for (int h = 0; h < p; h++) {
		cin >> n;
		maxup = 0;
		maxdown = 0;
		for (int i = 0; i < n; i++) {
			cin >> a[i];
			if (i >= 1) {
				if (a[i - 1] > a[i]) {
					maxdown = max(maxdown, a[i - 1] - a[i]);
				}
				else {
					maxup = max(maxup, a[i] - a[i - 1]);
				}
			}
		}
		cout << maxup << ' ' << maxdown << endl;
	}
	return 0;
}