#include using namespace std; using ll = long long; int main () { int N; cin >> N; ll A[1 << 5][200020]; ll B[1 << 5][2]; for (int i = 0; i < N; i ++) { ll X[5]; for (int j = 0; j < 5; j ++) { cin >> X[j]; } for (int pk = 0; pk < (1 << 5); pk ++) { A[pk][i] = 0; for (int j = 0; j < 5; j ++) { A[pk][i] += X[j] * (((pk >> j) & 1) ? 1 : -1); } } } for (int i = 0; i < (1 << 5); i ++) { B[i][0] = *max_element(A[i], A[i] + N); B[i][1] = *min_element(A[i], A[i] + N); } for (int i = 0; i < N; i ++) { ll ans = 0; for (int j = 0; j < (1 << 5); j ++) { ans = max({ans, A[j][i] - B[j][1], B[j][0] - A[j][i]}); } cout << ans << endl; } }