#include <iostream>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		if(!n)break;
		int max=0,min=500;
		while(n--){
			int s=0,p;
			for(int i=0;i<5;++i){
				cin>>p;
				s+=p;
			}
			if(s>max)max=s;
			if(s<min)min=s;
		}
		cout<<max<<" "<<min<<"\n";
	}
	return 0;
}