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

#define rep(n) for(int i=0;i<n;i++)

int block[101];

void solve() {
	int n; cin>>n;
	for (int i = 0; i < n; i++) {
		cin>>block[i];
	}

	int bh = block[0];
	int mcu = 0, mcd = 0;
	for (int i = 1; i < n; i++) {
		//cout<<bh<<"|"<<block[i]<<endl;
		if (bh < block[i]) {
			mcu = max(mcu, block[i] - bh);
		} else {
			mcd = max(mcd, bh - block[i]);
		}
		bh = block[i];
	}
	cout<<mcu<<" "<<mcd<<endl;
	
}

int main(int argc, const char *argv[]) {
	int n; cin>>n;
	rep(n) solve();
	return 0;
}