#include<iostream>
#include<vector>
#include<algorithm>

struct P{
	int x, y;
};

bool operator==(const P& lp, const P& rp){
	return (lp.x == rp.x) && (lp.y == rp.y);
}

const int INF = 1 << 24;

int main(){
	int matrix[100][100];
	int n;
	while(std::cin >> n, n){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				std::cin >> matrix[i][j];
			}
		}

		std::vector<P> sv, tv, temp_v;
		for(int i=0;i<n;i++){
			int s_height = INF;
			for(int j=0;j<n;j++){
				if(matrix[i][j] < s_height){
					temp_v.clear();
					temp_v.push_back({j, i});
					s_height = matrix[i][j];
				}else if(matrix[i][j] == s_height){
					temp_v.push_back({j, i});
				}
			}
			for(int k=0;k<temp_v.size();k++){
				sv.push_back(temp_v[k]);
			}
			temp_v.clear();

			int t_height = 0;
			for(int j=0;j<n;j++){
				if(matrix[j][i] > t_height){
					temp_v.clear();
					temp_v.push_back({i, j});
					t_height = matrix[j][i];
				}else if(matrix[j][i] == t_height){
					temp_v.push_back({i, j});
				}
			}
			for(int k=0;k<temp_v.size();k++){
				tv.push_back(temp_v[k]);
			}
			temp_v.clear();
		}

		int res = 0;
		for(int i=0;i<sv.size();i++){
			P p = sv[i];
			if(std::find(tv.begin(), tv.end(), p) != tv.end()){
				res = matrix[p.y][p.x];
				break;
			}
		}

		std::cout << res << std::endl;
	}
}