#include <stdio.h>

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

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

  for ( ; ; )
  {
    int mx = 0, mn = 500;
    int n;

    scanf ( "%d", &n );
    if ( !( n ) ) break ;

    while ( n-- )
    {
      int a, b, c, d, e;

      scanf ( "%d%d%d%d%d", &a, &b, &c, &d, &e );
      d += a + b + c + e;

      mx = MAX( mx, d );
      mn = MIN( mn, d );
    }

    printf ( "%d %d\n", mx, mn );
  }

  return ( 0 );
}