#include <stdio.h>

int main(void)
{
	int n, i, j, num[10], sum[200] = {0}, max, min;
	
	while (scanf("%d", &n), n != 0){
		max = 0;
		min = 0;
		for (i = 0; i < 200; i++)sum[i] = 0;
		for (i = 0; i < n; i++){
			for (j = 0; j < 5; j++){
				scanf("%d", &num[j]);
				sum[i] += num[j];
			}
		}
		
		for (i = 0; i < n; i++){
			if (i == 0){
				max = sum[i];
				min = sum[i];
			}
			else if (max < sum[i])max = sum[i];
			else if (min > sum[i])min = sum[i];
		}
		
		printf("%d %d\n", max, min);
	}
	
	return (0);
	
}