#include <stdio.h>
int main(){
  int ans, t, n, h[100], i, j, up, down;
  scanf("%d",&t);
  for( j = 0 ; j < t ; j++ ){
    up = 0;
    down = 0;
    scanf( "%d",&n );
    for( i = 0 ; i < n ; i++ )
      scanf("%d",&h[i]);
    for( i = 0 ; i < (n-1) ; i++ ){
      if( h[i+1] > h[i] ){
	ans = h[i+1] - h[i];
	if(ans > up){
	  up = ans;
	}
      }else{
	ans = h[i] - h[i+1];
	if(ans > down){
	  down = ans;
	}
      }
    }
    printf("%d %d\n",up,down);
  }
  return 0;
}