#include <stdio.h>

int main(void)
{
	int n;
	
	while (scanf("%d", &n) * n != 0){
		int i, j;
		int maxi = 0;
		int mini = 1000000;
		
		for (i = 0; i < n; i++){
			int sum = 0;
			
			for (j = 0; j < 5; j++){
				int t;
				
				scanf("%d", &t);
				sum += t;
			}
			if (maxi < sum) maxi = sum;
			if (mini > sum) mini = sum;
		}
		printf("%d %d\n", maxi, mini);
	}
	
	return 0;
}