#include <stdio.h>

int main(void)
{
	int n, s, sum, max, min;
	int i, j;

	while (1) {
		scanf("%d", &n);
		if (n == 0)
			break;
		max = 0;
		for (i = 0; i < 5; i++) {
			scanf("%d", &s);
			max += s;
		}
		min = max; sum = 0;
		for (i = 1; i < n; i++) {
			sum = 0;
			for (j = 0; j < 5; j++) {  
				scanf("%d", &s);
				sum += s;
			}
			if (sum > max)
				max = sum;
			else if (sum < min)
				min = sum;
			
		}
		printf("%d %d\n", max, min);
	}
	return 0;
}