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

int main(){
	int m,n,s;
	cin >> m;
	for(int i=0;i<m;i++){
        cin >> n;
		int max = 0;
		int min = 0;
		vector<int> b(n);
		for(int j=0;j<n;j++){
			cin >> b[j];
		}
		for(int j=1;j<n;j++){
			if((b[j] - b[j-1]) > 0){
				if(max <= (b[j] - b[j-1])){
					max = b[j] - b[j-1];
				}
			}else if((b[j] - b[j-1]) < 0){
				if(min <= (b[j-1] - b[j])){
					min = b[j-1] - b[j];
				}
			}
			
		}
		cout << max << " " << min << endl;
	}	
		return 0;
}
	