#include using namespace std; void fast_io() { ios::sync_with_stdio(false); std::cin.tie(nullptr); } int main() { fast_io(); int n; cin >> n; vector> a(n, vector(5)); vector> b(n, vector(16)); for (int i = 0; i < n; ++i) { for (int j = 0; j < 5; ++j) { cin >> a[i][j]; } for (int k = 0; k < 16; k++) { for (int j = 0; j < 4; j++) { if (k & (1 << j)) { b[i][k] += a[i][j]; } else { b[i][k] -= a[i][j]; } } b[i][k] += a[i][4]; } } vector ma(16, -1e18), mi(16, 1e18); for (int i = 0; i < n; ++i) { for (int k = 0; k < 16; ++k) { ma[k] = max(ma[k], b[i][k]); mi[k] = min(mi[k], b[i][k]); } } for (int i = 0; i < n; i++) { long long ans = 0; for (int k = 0; k < 16; k++) { ans = max({ans, ma[k] - b[i][k], b[i][k] - mi[k]}); } cout << ans << endl; } }