#include <stdio.h>

int main(void)
{
	int num[5], sum, n, small, large;
	int i, j, k;
	
	while (scanf("%d", &n), n != 0){
		large = 0;
		small = 1000;
		for (k = 0; k < n; k++){
			sum = 0;
			for (j = 0; j < 5; j++){
				scanf("%d", &num[j]);
				sum += num[j];
			}
			if (large < sum){
				large = sum;
			}
			if (small > sum){
				small = sum;
			}
		}
		
		printf("%d %d\n", large, small);
	}
	
	return 0;
}