#include <stdio.h>

int main() {

  int max,min,mar,t,n;
  int i,j,k,h,h2 = 0;

  scanf("%d",&t); 

      for(i=0;i<t;i++) {


	scanf("%d",&n);

	max = 0;
	min = 0;


	for(j=0;j<n;j++) {

	  scanf("%d",&h);
       
	 

	  if(j !=0) {
	    mar = h2 -h;
	    if(h2 - h <  max) max = h2 - h;
	    if(h2 -h > min) min = h2 -h;
	  } 
	  h2 = h;
	     
	}
	printf("%d %d\n",-1*max,min);
      
      }

    return 0;

}