#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

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

	int t;
	cin >> t;
	while (t--) {
		int n;
		cin >> n;
		vector<int> h(n);

		for (int i = 0; i < n; i++) {
			cin >> h[i];
		}
		int up = 0, down = 0;
		for (int i = 0; i < n - 1; i++) {
			if (h[i] < h[i + 1]) {
				up = max(up, abs(h[i] - h[i + 1]));
			}
			else {
				down = max(down, abs(h[i] - h[i + 1]));
			}
		}

		cout << up << " " << down << endl;
	}
}