#include<stdio.h>
int main(){
	int i,j,n,sum,max,min,s1,s2,s3,s4,s5;
	for(;scanf("%d",&n)&&n;){
		for(i=0;i<n&&scanf("%d %d %d %d %d",&s1,&s2,&s3,&s4,&s5);i++){
			sum=s5+s1+s2+s3+s4;
			if(!i){
				max=sum;min=sum;
			}
			else if(i==1){
				if(max<sum){
					min=max;max=sum;
				}
				else if(min>sum){
					max=min;min=sum;
				}
			}
			else {
				if(max<sum)max=sum;
				if(min>sum)min=sum;
			}
		}
		printf("%d %d\n",max,min);
	}
	return 0;
}