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

int main(){
	int n,a,s;

	while( cin >> n , n ){
		vector<int> vc;
		for(int i=0 ; i<n ; ++i ){
			for(int j=0,s=0 ; j<5 ; ++j ){
				cin >> a;
				s += a;
				if( j == 4 )
					vc.push_back( s );
			}
		}
		sort( vc.begin() , vc.end() );
		cout << vc[vc.size()-1] << " " << vc[0] << endl;
	}
}