#include <iostream>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
  vector<int> result;
  int ex[5], max, min, n;
  while (true) {
    cin >> n;
    if (n == 0)
      break;
    max = 0;
    min = 500;
    for (int i = 0; i < n; i++) {
      int tmp, sum = 0;
      for (int j = 0; j < 5; j++) {
        cin >> tmp;
        sum += tmp;
      }
      if (sum > max)
        max = sum;
      if (sum < min)
        min = sum;
    }
    result.push_back(max);
    result.push_back(min);
  }

  for (int i = 0; i < result.size(); i += 2)
    cout << result[i] << ' ' << result[i+1] << endl;
  return 0;
}