#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    int n;
    while(scanf("%d",&n),n){
        int ma = 0,mi = 1000;
        for(int i = 0;i < n; i++){
            int x,sum=0;
            for(int j = 0;j < 5; j++){
                scanf("%d",&x);
                sum += x;
            }
            ma = max(ma,sum);
            mi = min(mi,sum);
        }
        printf("%d %d\n",ma,mi);
    }
    return 0;
}