#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int main() {
	int n;
	vector<int>maxd, mind;
	while (cin >> n) {
		if (n == 0)break;
		int maxs, mins;
		maxs = 0;
		mins = 500;
		for (int k = 0; k < n; k++){
			int a = 0, b;
			for (int i = 0; i < 5; i++) {
				cin >> b;
				a += b;
			}
			maxs = max(maxs, a);
			mins = min(mins, a);
		}
		maxd.push_back(maxs);
		mind.push_back(mins);
	}
	for (int i = 0; i != maxd.size(); i++){
		cout << maxd[i] << ' ' << mind[i] << endl;
	}
	char c;
	cin >> c;
	return 0;
}