#include<stdio.h>
 
int main(){
	int n, a, max = 0, min = 500, score = 0, i, j;
	while(scanf("%d", &n) != 0){
		if(n == 0) break;
		for(i = 0; i < n; i++){
			for(j = 0; j < 5; j++){
				scanf("%d", &a);
				score += a;
			}
			if(max < score) max = score;
			if(min > score) min = score;
			score = 0;
		}
		printf("%d %d\n", max, min);
		max = 0;
		min = 500;
	}
	return 0;
}