#include <stdio.h>

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