#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;

template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }

void solve() {
	int n;
	cin >> n;

	vector<int> h(n);
	for(auto &e : h) cin >> e;

	int max_up = 0, max_down = 0;
	for(int i = 0; i < n - 1; ++i) {
		chmax(max_up, h[i + 1] - h[i]);
		chmax(max_down, h[i] - h[i + 1]);
	}

	cout << max_up << " " << max_down << endl;
}

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int t;
	cin >> t;
	while(t--) solve();

	return EXIT_SUCCESS;
}