#include <stdio.h>

int main(void){
	int n,nc,score,i;
	int sum,max,min;
	while(1){
		scanf("%d",&n);
		if(n == 0){break;}
		nc = n;
		do{
			sum = 0;
			for(i = 0; i < 5; i++){
				scanf("%d",&score);
				sum += score;
			}
			if(nc == n){
				max = sum;
				min = sum;
			}else{
				if(sum > max){
					max = sum;
				}
				if(sum < min){
					min = sum;
				}
			}
			nc--;
		}while(nc > 0);
		
		printf("%d %d\n",max,min);
	}


	return 0;
}