#include <stdio.h>

int main(void)
{
    int n;
    int s1, s2, s3, s4, s5;
    int max, min, sum;
    int i;
    
    while (1){
        scanf("%d", &n);
        if (n == 0){
            break;
        }
        
        scanf("%d%d%d%d%d", &s1, &s2, &s3, &s4, &s5);
        
        min = max = s1 + s2 + s3 + s4 + s5;
        
        for (i = 1; i < n; i++){
            scanf("%d%d%d%d%d", &s1, &s2, &s3, &s4, &s5);
            
            sum = s1 + s2 + s3 + s4 + s5;
            
            if (max < sum){
                max = sum;
            }
            if (min > sum){
                min = sum;
            }
        }
        
        printf("%d %d\n", max, min);
        
    }
    return (0);
}