#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i;
  int a[100],n;
  while(cin>>n&&n){
    for(i=0;i<n;i++){
      int p,q,r,s,t;
      cin>>p>>q>>r>>s>>t;
      a[i]=p+q+r+s+t;
    }
    sort(a,a+n);
    cout<<a[n-1]<<" "<<a[0]<<endl;
  }
  return 0;
}