#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;
}