#include <stdio.h>

int main() {

  int n,sum,s;
  int j,i;
  int min ;
  int max;


  while(1) {

  scanf("%d",&n);
  max = -1;
  min = 1000;
  if(n == 0) break;

  for(i=0;i<n;i++) {
    sum = 0;
    for(j=0;j<5;j++) {

      scanf("%d",&s);

      sum = sum + s;
    }

      if(sum < min) min = sum;
      if(sum > max) max = sum;
  }

  printf("%d %d\n",max,min);

  }

  return 0;

}