#include<stdio.h>
int main()
{
  int n,s,i,j,total,x,max,min;

  while(1){
    
    scanf("%d",&n);
    if(n==0) break;
    
    for(i=0; i<n; i++){
      total=0;
      
      for(j=0; j<5; j++){
	scanf("%d",&s);
	total+=s;
      }

      if(i==0){
	max=total;
	min=total;
      }
      if(max<total){
	x=max;
	max=total;
	total=x;
      }
      if(total<min){
	x=min;
	min=total;
	total=x;
      }
    }
  
    printf("%d %d\n",max,min);

  }
  
  return 0;
}