#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

void solve()
{
	int n;
	while(cin >> n, n)
	{
		vector<int> sum(n);
		for(int i = 0; i < n; ++i)
		{
			for(int j = 0; j < 5; ++j)
			{
				int point;
				cin >> point;
				sum[i] += point;
			}
		}
		sort(sum.begin(), sum.end());
		cout << sum[n - 1] << " " << sum[0] << endl;
	}
}

int main()
{
	solve();
	return(0);
}