#include <stdio.h>


int main(){

  int n, s, z, i, j, max, min;

  while(1){

    scanf("%d", &n);

    if(n == 0)
      break;

    max = 0;
    min = 500;

    for(i = 0;i < n;i++){

      z = 0;

      for(j = 0;j < 5;j++){
	scanf("%d", &s);
	z += s;
      }
      
      if(max < z){
	max = z;
      }

      if(min > z){
	min = z;
      }

    }

    printf("%d %d\n", max, min);
    
  }

  
  return 0;
}