#include <stdio.h>

int main(void) {
	int min,max;
	int now,nowsum;
	int n,i,j;
	while(1) {
		scanf("%d",&n);
		if(n==0)break;
		min=0x7fffffff;max=-0x7fffffff;
		for(i=0;i<n;i++) {
			for(j=0,nowsum=0;j<5;j++) {
				scanf("%d",&now);
				nowsum+=now;
			}
			if(nowsum<min)min=nowsum;
			if(nowsum>max)max=nowsum;
		}
		printf("%d %d\n",max,min);
	}
	return 0;
}