#include <iostream>

using namespace std;

int main() {
    int n; 
    while (cin >> n) {
        if (n == 0) break;
        int min = 100000, max = 0;
        while (n--) {
            int sum = 0;
            for (int i = 0; i < 5; i++) {
                int s; cin >> s;
                sum += s;
            }
            if (min > sum) min = sum;
            if (max < sum) max = sum;
        }
        cout << max << ' ' << min << endl;
    }
    return 0;
}