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

int main()
{
	int N;
	cin >> N;
	while (N--)
	{
		int n;
		cin >> n;
		int a[n];
		for (int i=0; i<n; i++)
			cin >> a[i];

		vector<int> b(1,0), c(1,0);
		for (int i=0; i<n-1; i++)
		{
			int tmp = a[i+1]-a[i];
			if (tmp > 0)
				b.push_back(tmp);
			else
				c.push_back(-tmp);
		}

		sort(b.begin(), b.end());
		sort(c.begin(), c.end());

		cout << b.back() << ' ' << c.back() << endl;
	}
}