#include <stdio.h>
#include <stdlib.h>
 
int main(void) { 
  
  int count;
  
  scanf("%d", &count);
  
  int i;
  for(i = 0; i < count; i++) {
      int blockCount;
      scanf("%d", &blockCount);
      
      int j;
      int before, next, upDiff, downDiff;
      upDiff = downDiff = 0;
      
      scanf("%d", &before);
      
      for(j = 1; j < blockCount; j++) {
          scanf("%d", &next);
          int currentDiff = next - before;
          before = next;
          
          if(currentDiff > 0) { //登るとき
              if(currentDiff > upDiff) {
                  upDiff = currentDiff;
              }
          } else { //降りるとき
              if(currentDiff < downDiff) {
                  downDiff = currentDiff;
              }
          }
      }

      printf("%d %d\n", upDiff, abs(downDiff));
  }
  
  return 0;
  
}