#include <algorithm>
#include <sstream>
#include <iostream>
#include <map>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
using namespace std;

#define rep(i,n) for(int i = 0;i<n;i++)
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define FORIT(i,c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define ISEQ(c) (c).begin(), (c).end()

int main() {
	while(true){
		int N;
		vector<int> v;
		cin >> N;
		if(N==0)break;
		rep(i,N){
			int s = 0;
			rep(j,5){
				int k;
				cin >> k;
				s += k;
			}
			v.push_back(s);
		}
		sort(v.begin(),v.end());
		cout << v[v.size()-1] << " " << v[0] << endl;
	}
	return 0;
}