#include<stdio.h>

int main(void)
{
  int t;
  int n;
  int i,j;
  int data[100][100];
  int up[100] = {0};
  int down[100] = {0};
  int judge;

  scanf("%d",&t);
  
  for(i=0;i<t;i++){
    
    scanf("%d",&n);
    
    for(j=0;j<n;j++){
      
      scanf("%d",&data[i][j]);
	
	}
    
    for(j=0;j<n-1;j++){
      
      judge = data[i][j+1] - data[i][j];
      
      if((judge >= 0) && (judge > up[i])){
	
	up[i] = judge;
	
      }
      
      else if((judge < 0) && (judge < down[i])){
	
	down[i] = judge;
	
      }
      
    }
    
  }
  
  for(i=0;i<t;i++)
    printf("%d %d\n",up[i],-down[i]);
  
  return 0;
  
}