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

int main(){

  int t;
  int n;
  int h;
  int a[500];
  int x,y;

  cin >> t;

  for(int l=0;l<t;l++){
    x = y = 0;

    cin >> n;
    cin >> a[0];

    for(int i=1;i<n;i++){
      cin >> a[i];

      x = max(a[i]-a[i-1],x);
      if(a[i-1]-a[i] >= 0) y = max(a[i-1]-a[i],y);

    }
 
    cout << x << " " << y << endl;

  }
}