#include <stdio.h> 
#include <stdlib.h> 

int main(void){ 

  int i,j,k; 
  int count1,count2;  
  int str[10000]; 
  int ans[100]; 
  int max=0; 
  int min=0; 

  scanf("%d", &i); 
  for(count1=0; count1<i; count1++){ 
    scanf("%d",&j); 

    for(count2=0; count2<j; count2++){ 
      scanf("%d",&str[count2]);   
      if(count2>0){ 
 ans[count2-1]=str[count2]-str[count2-1]; 
      } 
    } 
     
    for(k=0; k<j-1; k++){ 
      if(ans[k]>max){ 
 max=ans[k]; 
      } 
      if(ans[k]<min){ 
 min=ans[k]; 
      } 
    } 
     
    printf("%d %d\n",max,abs(min)); 
    max=0; 
    min=0; 
  } 
  return 0; 
}
