#include <stdio.h>
#include <limits.h>

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

  scanf ( "%d", &n );
  while ( n != 0 )
  {
    int min = INT_MAX;
    int max = INT_MIN;

    while ( n-- )
    {
      int a, b, v, g, d;
      int ptr;

      scanf ( " %d %d %d %d %d", &a, &b, &v, &g, &d );
      ptr = a + b + v + g + d;

      if ( ptr > max )
      {
        max = ptr;
      }
      if ( ptr < min )
      {
        min = ptr;
      }
    }
    printf ( "%d %d\n", max, min );

    scanf ( " %d", &n );
  }

  return ( 0 );
}