#include <stdio.h>
int main(){
  int i,j,sum,min,max,n,m;

  while(1){
    scanf("%d",&m);
    if(m == 0) break;
    min = 101;
    max = -1;
    for(i=0;i<m;i++){
      for(sum=0,j=0;j<5;j++){
	scanf("%d",&n);
	sum += n;
      }
      if(max<sum) max=sum;
      if(min>sum) min=sum;
    }
    printf("%d %d\n",max,min);
  }
  return 0;
}