#include <stdio.h>

int main(){
  int t,n,i,a[100],Max,Min;
  scanf("%d",&t);
  while(t--){
    scanf("%d",&n);
    for(i=0;i<n;i++){
      scanf("%d",&a[i]);
    }
    Max = Min = a[1] - a[0];
    for(i=1;i<n-1;i++){
      if(Max < a[i+1]-a[i])Max = a[i+1]-a[i];
      if(Min > a[i+1]-a[i])Min = a[i+1]-a[i];
    }
    if(Max >= 0 && Min <= 0) printf("%d %d\n",Max,-Min);
    if(Max < 0) printf("%d %d\n",0,-Min);
    if(Min > 0) printf("%d %d\n",Max,0);
  }
  return 0;
}