#include<stdio.h>

int main(){
  int i, j, n, m, x, y, up, down;

  scanf("%d", &n);

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

    for(j=0, up=0, down=0; j<m; ++j){
      scanf("%d", &x);

      if(j != 0){
	if(x > y && up < x-y)
	  up = x-y;
	else if(x < y && down < y-x)
	  down = y-x;
      }
      y = x;
    }
    printf("%d %d\n", up, down);
  }

  return 0;
}