#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int n;

void solve()
{
	vector<int> res(n);
	for(int i = 0; i < n; i++){
		int sum = 0, in;
		for(int j = 0; j < 5; j++){
			cin >> in;
			sum += in;
		}
		res[i] = sum;
	}
	sort(res.begin(), res.end());

	cout << res.back() << ' ' << res.front() << endl;
}

int main(void)
{
	while(cin >> n, n)
		solve();
	return 0;
}