#include using namespace std; typedef long long int ll; typedef pair P; typedef vector VI; typedef vector VVI; #define REP(i,n) for(int i=0;i<(n);i++) #define ALL(v) v.begin(),v.end() template bool chmax(T& x, const T& y){return (x bool chmin(T& x, const T& y){return (x>y)?(x=y,true):false;}; constexpr ll MOD=998244353; constexpr ll INF=2e18; int main(){ int n; cin >> n; VVI a(n,VI(5)); REP(i,n)REP(j,5) cin >> a[i][j]; VI b; REP(i,1<<5){ vector

p(n); REP(j,n){ ll sum=0; REP(k,5){ if((i>>k)&1) sum+=a[j][k]; else sum-=a[j][k]; } p[j]={sum,j}; } sort(ALL(p)); b.push_back(p[n-1].second); } REP(i,n){ ll ans=0; for(auto j:b){ ll sum=0; REP(k,5){ sum+=abs(a[i][k]-a[j][k]); } chmax(ans,sum); } cout << ans << endl; } return 0; }