#include <stdio.h>

int main(){
	int count;
	while(1){
		int max=0,min=999999;
		scanf("%d",&count);
		if(!count)break;
		int i,j;
		int a,sum;
		for(i=0;i<count;i++){
			sum=0;
			for(j=0;j<5;j++){
				scanf("%d",&a);
				sum+=a;
			}
			if(min>sum){
			min=sum;
			}
			if(max<sum){
				max=sum;
			}
		}
		printf("%d %d\n",max,min);
	}
	return 0;
}