#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<map>
#include<queue>
#include<set>

using namespace std;
typedef pair<int,int> PII;
typedef long long ll;

int student[100][100];
bool target[100][100];

int main(){
	while(true){
		int n;
		cin>>n;
		if(!n)break;
		for(int y=0;y<n;y++){
			for(int x=0;x<n;x++){
				cin>>student[y][x];
				target[y][x] = false;
			}
		}
		for(int y=0;y<n;y++){
			int min_st = 1e5;
			int min_x = -1;
			for(int x=0;x<n;x++){
				if(min_st>student[y][x]){
					min_st = student[y][x];
				}
			}
			for(int x=0;x<n;x++)
				if(min_st == student[y][x])
					target[y][x] = true;
		}

		int ans = 0;
		for(int x = 0;x<n;x++){
			int max_st = 0;
			int max_y = -1;
			for(int y=0;y<n;y++){
				if(max_st<student[y][x]){
					max_y = y;
					max_st = student[y][x];
				}
			}
			for(int y=0;y<n;y++){
				if(max_st == student[y][x]){
					if(target[y][x]){
						ans = student[y][x];
					}
				}
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}