#include <bits/stdc++.h>
using namespace std;

#ifdef _RUTHEN
#include <debug.hpp>
#else
#define show(...) true
#endif

using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
template <class T> using V = vector<T>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    V<V<long long>> A(5, V<long long>(N));
    rep(i, N) rep(j, 5) cin >> A[j][i];
    const int M = 5, M2 = 1 << 5;
    const long long INF = 1LL << 60;
    V<long long> S(M2, -INF);
    rep(i, N) {
        rep(bit, M2) {
            long long c = 0;
            rep(j, 5) {
                if (bit >> j & 1) {
                    c += A[j][i];
                } else {
                    c -= A[j][i];
                }
            }
            S[bit] = max(S[bit], c);
        }
    }
    rep(i, N) {
        long long ans = -INF;
        rep(bit, M2) {
            long long c = 0;
            rep(j, 5) {
                if (bit >> j & 1) {
                    c -= A[j][i];
                } else {
                    c += A[j][i];
                }
            }
            ans = max(ans, c + S[bit]);
        }
        cout << ans << '\n';
    }
    return 0;
}