#include using namespace std; #define int long long const int N = 100010; int sum[N][33]; int maxn[33]; int n; signed main () { cin >> n; for (int i = 0; i < 32; i ++ ) { maxn[i] = -LLONG_MAX; } for (int i = 1; i <= n; i ++ ) { vector a(6); for (int j = 0; j < 5; j ++ ) { cin >> a[j]; } for (int p = 0; p < 32; p ++ ) { for (int k = 0; k < 5; k ++ ) { sum[i][p] += ((p >> k) & 1 ? a[k]: -a[k]); } maxn[p] = max(maxn[p], sum[i][p]); } } for (int i = 1; i <= n; i ++ ) { int res = 0; for (int p = 0; p < 32; p ++ ) { res = max(res, sum[i][p] + maxn[31 ^ p]); } cout << res << '\n'; } }