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

int main(){
	int n;
	while(cin >> n && n){
		int g_max = -1;
		int g_min = 1000;
		for(int i = 0; i < n; i++){
			int grade = 0;
			for(int j = 0; j < 5; j++){
				int g;
				cin >> g;
				grade += g;
			}
			g_max = max(g_max, grade);
			g_min = min(g_min, grade);
		}
		cout << g_max << " " << g_min << endl;
	}
	return 0;
}