#include <iostream>
using namespace std;
int main() {
int n;
int mer=0; // most excited row
int lec=0; // least excited column
cin >> n;
int **table=new int *[n];
for (int i=0; i<n; i++)
table[i]= new int [n];
for (int i=0; i<n; i++)
for (int j=0; j<n; j++)
cin >> table[i][j];
int *exc= new int [n]; // excitation of the rows / columns
for (int l=0; l<n; l++){
exc[l]=0;
for (int i=0; i<n; i++)
exc[l]+=table[l][i];
}
for (int i=0; i<n; i++){
if (exc[mer] < exc[i]){
exc[mer]=exc[i];
mer=i;
}
}
for (int k=0; k<n; k++){
exc[k]=0;
for (int j=0; j<n; j++)
exc[k]+=table[j][k];
}
for (int i=0; i<n; i++){
if (exc[lec] > exc[i]){
exc[lec]=exc[i];
lec=i;
}
}
cout << table[mer][lec];
for (int i = 0; i < n; i++)
delete []table[i];
delete []table;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgbjsgCglpbnQgbWVyPTA7CQkJCQkvLyBtb3N0IGV4Y2l0ZWQgcm93CglpbnQgbGVjPTA7CQkJCQkvLyBsZWFzdCBleGNpdGVkIGNvbHVtbgoJY2luID4+IG47CglpbnQgKip0YWJsZT1uZXcgaW50ICpbbl07Cglmb3IgKGludCBpPTA7IGk8bjsgaSsrKQoJCXRhYmxlW2ldPSBuZXcgaW50IFtuXTsKCWZvciAoaW50IGk9MDsgaTxuOyBpKyspCgkJZm9yIChpbnQgaj0wOyBqPG47IGorKykKCQkJY2luID4+IHRhYmxlW2ldW2pdOwoJaW50ICpleGM9IG5ldyBpbnQgW25dOwkJLy8gZXhjaXRhdGlvbiBvZiB0aGUgcm93cyAvIGNvbHVtbnMKCWZvciAoaW50IGw9MDsgbDxuOyBsKyspewoJCWV4Y1tsXT0wOwoJCWZvciAoaW50IGk9MDsgaTxuOyBpKyspCgkJCWV4Y1tsXSs9dGFibGVbbF1baV07Cgl9Cglmb3IgKGludCBpPTA7IGk8bjsgaSsrKX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