#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include using namespace std; using namespace atcoder; int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; vector X_min(1<<5, 1LL<<60), X_max(1<<5, -(1LL<<60)); vector> X(N, vector(1<<5)); for( int i = 0; i < N; i++ ) { vector Y(5); cin >> Y[0] >> Y[1] >> Y[2] >> Y[3] >> Y[4]; for( int S = 0; S < (1<<5); S++ ) { for( int j = 0; j < 5; j++ ) { if( (S>>j)&1 ) { X[i][S] += Y[j]; }else { X[i][S] -= Y[j]; } } X_min[S] = min(X_min[S], X[i][S]); X_max[S] = max(X_max[S], X[i][S]); } } for( int i = 0; i < N; i++ ) { long long ans = 0; for( int S = 0; S < (1<<5); S++ ) { ans = max({ans, X_max[S]-X[i][S], X[i][S]-X_min[S]}); } cout << ans << endl; } }