#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
  int n, h[101], w[101], t;
  int a[101][101];

  while(cin>>n && n){
    for(int i = 0; i < n; ++i){
      for(int j = 0; j < n; ++j)
	cin >> a[i][j];
      h[i] = 0;
      w[i] = 101;
    }

    for(int i = 0; i < n; ++i)
      for(int j = 0; j < n; ++j){
	h[i] = max(h[i], a[j][i]);
	w[i] = min(w[i], a[i][j]);
      }

    t = 101;
    for(int i = 0; i < n; ++i)
      for(int j = 0; j < n; ++j)
	if(h[i] == w[j] && t > h[i]) t = h[i];

    cout << ((t == 101)? 0 : t) << endl;
  }

  return 0;
}