#include <iostream>
#include <algorithm>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)

int main(){
	int n;
	while(cin >> n, n){
		int smax = 0;
		int smin = 1<<29;
		rep(i, n){
			int sum = 0;
			rep(j, 5){
				int x;
				cin >> x;
				sum += x;
			}
			smax = max(smax, sum);
			smin = min(smin, sum);
		}
		cout << smax << ' ' << smin << endl;
	}
	return 0;
}