#include <stdio.h>

#define MAX(D,S) \
  { \
    if ( (S) > (D) ) \
    { \
      (D) = (S); \
    } \
  }
#define MIN(D,S) \
  { \
    if ( (S) < (D) ) \
    { \
      (D) = (S); \
    } \
  }

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int n;

  scanf ( "%d", &n );

  while ( n-- )
  {
    int p, c;
    int m;
    int up = 0, dn = 0;

    scanf ( " %d", &m );
    for ( scanf ( " %d", &p ); --m; )
    {
      scanf ( "%d", &c );
      MAX( up, c-p );
      MIN( dn, c-p );

      p = c;
    }

    printf ( "%d %d\n", up, -dn );
  }

  return ( 0 );
}