#include #define int long long #define rep(i, n) for(i = 0; i < n; i++) using namespace std; int n; int a[100000][5]; int b[100000][1 << 4]; int maxB[1 << 4]; int minB[1 << 4]; signed main() { int i, j, k; int d = 5; cin >> n; rep(i, n) rep(j, d) cin >> a[i][j]; int INF = 1e+18; rep(i, (1 << (d - 1))) { maxB[i] = -INF; minB[i] = INF; } rep(i, n) { rep(j, (1 << (d - 1))) { //j次元目の座標 int val = a[i][0]; rep(k, d - 1) { if ((j >> k) % 2 == 1) val += a[i][k + 1]; else val -= a[i][k + 1]; } b[i][j] = val; maxB[j] = max(maxB[j], b[i][j]); minB[j] = min(minB[j], b[i][j]); } } rep(i, n) { int ans = 0; rep(j, (1 << (d - 1))) { int score1 = maxB[j] - b[i][j]; int score2 = b[i][j] - minB[j]; ans = max(ans, score1); ans = max(ans, score2); } cout << ans << endl; } return 0; }