#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

using namespace std;

typedef pair<int,int> pii;

int main(){

  while(true){
    int n;
    scanf("%d", &n);

    if(n == 0) break;

    int mass[100][100] = {};
    int hand[100][100] = {};
    REP(i,n){
      REP(j,n){
        scanf("%d", &mass[i][j]);
      }
    }

    REP(i,n){
      int min_h = INF;
      REP(j,n){
        min_h = min(min_h, mass[i][j]);
      }
      REP(j,n){
        if(mass[i][j] == min_h){
          hand[i][j]++;
        }
      }
    }

    REP(i,n){
      int max_h = -1;
      REP(j,n){
        max_h = max(max_h, mass[j][i]);
      }
      REP(j,n){
        if(mass[j][i] == max_h){
          hand[j][i]++;
        }
      }
    }

    int ans = 0;
    REP(i,n){
      REP(j,n){
        if(hand[i][j] == 2) ans = max(ans, mass[i][j]);
      }
    }

    printf("%d\n", ans);
  }


  return 0;
}


