#include <stdio.h>

int main(void)
{
	int num;
	int temp[5];
	int i;
	int sum, min, max;
	
	while (1){
		scanf("%d", &num);
		
		if (num == 0) break;
		
		for (i = 0; i < num; i++){
			scanf("%d%d%d%d%d", &temp[0], &temp[1], &temp[2], &temp[3], &temp[4]);
			sum = temp[0] + temp[1] + temp[2] + temp[3] + temp[4];
			
			if (i == 0) min = max = sum;
			else {
				if (sum < min) min = sum;
				if (sum > max) max = sum;
			}
		}
		printf("%d %d\n", max, min);
	}
	
	return (0);
}