//https://onlinejudge.u-aizu.ac.jp/challenges/sources/VPC/UTPC/2204?year=2010

#include <bits/stdc++.h>

using namespace std;

int main() {
    int n;
    while (cin >> n, n) {
        int ans_max = 0, ans_min = 500;
        for (int i = 0; i < n; ++i) {
            int tmp = 0;
            for (int j = 0; j < 5; ++j) {
                int a;
                cin >> a;
                tmp += a;
            }
            ans_max = max(tmp, ans_max);
            ans_min = min(tmp, ans_min);
        }

        cout << ans_max << " " << ans_min << endl;
    }
    return 0;
}

/*
 *
 */
