#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cstring>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

int main()
{
    int n;
    while(cin >> n && n)
    {
        int mmin = 100 * 5, mmax = 0;
        int t, now;

        REP(n)
        {
            now = 0;
            rep(j,5) { cin >> t; now += t;}

            mmin = min(mmin, now);
            mmax = max(mmax, now);
        }
        cout << mmax << " " << mmin << endl;
    }

    return 0;
}