// 提出時にassertはオフ #ifndef DEBUG #ifndef NDEBUG #define NDEBUG #endif #endif #include using namespace std; using ll = long long; #define ALL(x) (x).begin(), (x).end() template using vec = vector; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vec> param(N, vec(5)); vec> manhattan(N, vec(1 << 4)); vec maxManhattan(1 << 4), minManhattan(1 << 4); for(int i = 0; i < N; i++) { for(int j = 0; j < 5; j++) { cin >> param[i][j]; } } for(int i = 0; i < (1 << 4); i++) { for(int j = 0; j < N; j++) { ll sum = param[j][4]; for(int k = 0; k < 4; k++) { if(i & (1 << k)) { sum += param[j][k]; } else { sum -= param[j][k]; } } manhattan[j][i] = sum; } } for(int i = 0; i < (1 << 4); i++) { ll maxI = -1e+18, minI = 1e+18; for(int j = 0; j < N; j++) { maxI = max(maxI, manhattan[j][i]); minI = min(minI, manhattan[j][i]); } maxManhattan[i] = maxI, minManhattan[i] = minI; } for(int i = 0; i < N; i++) { ll ans = 0; for(int j = 0; j < (1 << 4); j++) { ans = max({ans, maxManhattan[j] - manhattan[i][j], manhattan[i][j] - minManhattan[j]}); } cout << ans << "\n"; } }