#include <stdio.h>
#include <stdlib.h>

#define MIN(A,B) \
  ( (B) < (A) ? (B) : (A) )
#define MAX(A,B) \
  ( (B) > (A) ? (B) : (A) )

int
main (
  int   argc,
  char *argv[ ]
  )
{
  int m;
  int i, j;

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

    scanf ( "%d%d", &n, &p );
    for ( j = 1; j < n; ++j )
    {
      int d;

      scanf ( "%d", &d );
      if ( d - p < 0 )
        md = MIN( md, d - p );
      else
        mu = MAX( mu, d - p );

      p = d;
    }

    printf ( "%d %d\n", mu, -md );
  }

  return ( EXIT_SUCCESS );
}