#include <iostream>

using namespace std;

int main()
{
    int n;

    while (cin >> n, n) {
        int s, min_s = 500, max_s = 0;

        for (int i = 0; i < n; ++i) {
            int sum = 0;
            for (int j = 0; j < 5; ++j) {
                cin >> s;
                sum += s;
            }
            min_s = min(min_s, sum);
            max_s = max(max_s, sum);
        }
        cout << max_s << " " << min_s << endl;
    }

    return 0;
}