/*
  AOJ 2100
  Title:Saizo
  @kankichi573
*/
#include <stdio.h>
#define max(x,y) (((x)>(y))?(x):(y))
int d,N;


main()
{
  int i,j,ret,prev,now,max_up,max_down,diff;
  scanf("%d",&d);
  for(i=0;i<d;i++)
    {
      scanf("%d",&N);
      scanf("%d",&prev);
      max_up=max_down=0;
      for(j=1;j<N;j++)
	{
	  scanf("%d",&now);
	  diff=now-prev;
	  if(diff>0)
	    max_up=max(max_up,diff);
	  else
	    max_down=max(max_down,-diff);
	  prev=now;
	}
      printf("%d %d\n",max_up,max_down);
    }
  return(0);
}