#include<stdio.h>

int main(){
  int i, n, a, b, c, d, e, sum, max, min;

  while(1){
    scanf("%d", &n);
    if(n == 0) break;

    for(i=0; i<n; ++i){
      scanf("%d %d %d %d %d", &a, &b, &c, &d, &e);
      sum = a + b + c + d + e;

      if(i == 0){
	max = sum;
	min = sum;
      }else{
	if(max < sum) max = sum;
	else if(min > sum) min = sum;
      }
    }

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