#include<bits/stdc++.h>
using namespace std;


int main(){

  int h,prev;
  int min,max;
  int t,n;

  cin >> t;

  for(int i=0; i<t; i++){
    
    max = 0; min = 0;
    cin >> n;
    cin >> prev;
    for(int j=1; j<n; j++){
      cin >> h;
      if(h>prev && max < h-prev)max = h-prev;
      if(h<prev && min > h-prev)min = h-prev;

      prev = h;

    }

    cout << max << ' ' << abs(min) << endl;
  }


  return 0;
}