#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int main(){
	int n;
	while(cin>>n,n){
		vvi in(n,vi(n));
		rep(i,n)rep(j,n)cin>>in[i][j];
		int out=0;
		rep(i,n){
			int ma=in[i][0];
			rep(j,n)ma=min(ma,in[i][j]);
			rep(j,n)if(ma==in[i][j]){
				int tmp=ma;
				rep(k,n)tmp=max(tmp,in[k][j]);
				if(tmp==ma)out=max(out,ma);
			}
		}
		cout<<out<<endl;
	}
}