#include<stdio.h>

int main(void){
  int n,m,i,j,a,b,upmax=0,downmax=0;
  int up[100], down[100];
  for(i=0;i<100;i++){
    up[i]=0;
    down[i]=0;
  }
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&m);
    scanf("%d",&a);
    for(j=0;j<m-1;j++){
      b=a;
      scanf("%d",&a);
      if(b>a){
	if(b-a>downmax) downmax=b-a;
      }else{
	if(a-b>upmax) upmax=a-b;
      }
    }
    up[i]=upmax;
    down[i]=downmax;
    downmax=0;
      upmax=0;
  }
  for(i=0;i<n;i++){
    printf("%d %d\n",up[i],down[i]);
  }
  return 0;
}