#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	int i, j, max, min, sum = 0, n = 1, test[1000][5] = {0};
	while (1) {
		max = -10000;
		min = 10000;
		scanf("%d", &n);
		if (n == 0)break;
		sum = 0;
		for (i = 0; i < n; i++) {
			sum = 0;
			for (j = 0; j < 5; j++) { scanf("%d", &test[i][j]); sum += test[i][j]; }
			if (min >= sum)min = sum;
			if (max <= sum)max = sum;
		}
		printf("%d %d\n", max, min);
		for (i = 0; i < n; i++) {
			for (j = 0; j < 5; j++) { test[i][j] = 0; }
		}
	}
	return 0;
}