#include <cstdio>
#include <algorithm>

using namespace std;

int main(void)
{
	int i, n, j, s;
	int score[128];
	
	while (scanf("%d", &n), n != 0){
		for (i = 0; i < 128; i++){
			score[i] = 0;
		}
		
		for (i = 0; i < n; i++){
			for (j = 0; j < 5; j++){
				scanf("%d", &s);
				score[i] += s;
			}
		}
		
		sort(score, score + n);
		
		printf("%d %d\n", score[n - 1], score[0]);
	}
	
	return (0);
}