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

int main(){
	
	int n;
	
	while(cin>>n){
		if(n!=0){
			int max=0,min=500;
			vector < vector<int> > s(n,vector<int>(5));
			for(int i=0;i<n;i++){
				int u=0;
				for(int j=0;j<5;j++){
					cin>>s[i][j];
					u+=s[i][j];
				}
				if(max<u)
					max=u;
				if(min>u)
					min=u;
			}
			cout<<max<<" "<<min<<endl;
		}
		else
			break;
	}
}