#include <stdio.h>

int n;
int s[100];

bool input() {
  int i;
  int a, b, c, d, e;

  scanf("%d", &n);
  if(!n) return false;

  for (i = 0; i < n; i++) {
    scanf("%d %d %d %d %d", &a, &b, &c, &d, &e);
    s[i] = a + b + c + d + e;
  }

  return true;
}


int main() {
  int i, min, max;

  while (input()) {
    min = s[0];
    max = s[0];
    for (i = 1; i < n; i++) {
      if (min > s[i]) min = s[i];
      if (max < s[i]) max = s[i];
    }
    printf("%d %d\n", max, min);
  }

}