#include <stdio.h>

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