#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>

using namespace std;


int main(){

	int n,maximum,minimum,sum,a,b,c,d,e;

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		maximum = -1;
		minimum = 1000000000;

		for(int loop = 0; loop < n; loop++){
			scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
			sum = a + b + c + d + e;
			maximum = max(maximum,sum);
			minimum = min(minimum,sum);
		}

		printf("%d %d\n",maximum,minimum);

	}

	return 0;
}