#include <iostream>
#include <vector>

using namespace std;

void solve()
{
	int t;
	cin >> t;
	for(int i = 0; i < t; ++i)
	{
		int n;
		cin >> n;
		vector<int> Vec(n);
		for(int j = 0; j < n; ++j)
		{
			cin >> Vec[j];
		}
		int Up = 0;
		int Down = 0;
		int height = Vec[0];
		for(int j = 1; j < n; ++j)
		{
			int diff = Vec[j] - Vec[j - 1];
			if(diff > Up)
			{
				Up = diff;
			}
			else if(diff < Down)
			{
				Down = diff;
			}
		}
		cout << Up << " " << -Down << endl;
	}
}

int main()
{
	solve();
	return(0);
}