#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
	int n;
	while(cin >> n&&n != 0) {
		int a[100][100];
		bool b[100][100];
		bool c[100][100];
		for (int i = 0; i < n; i++) {
			int d = 1000000;
			vector<int>e;
			for (int j = 0; j < n; j++) {
				cin >> a[i][j];
				if (d > a[i][j]) {
					e.clear();
					d = a[i][j];
					e.push_back(j);
				}
				else if (d == a[i][j]) {
					e.push_back(j);
				}
				b[i][j] = false;
				c[i][j] = false;
			}
			for (int z = 0; z < e.size(); z++) {
				b[i][e[z]] = true;
			}
		}
		for (int i = 0; i < n; i++) {
			int d = -1;
			vector<int>e;
			for (int j = 0; j < n; j++) {
				if (d < a[j][i]) {
					e.clear();
					d = a[j][i];
					e.push_back(j);
				}
				else if (d == a[j][i]) {
					e.push_back(j);
				}
			}
			for (int z = 0; z < e.size(); z++) {
				c[e[z]][i] = true;
				if (b[e[z]][i]) {
					cout << a[e[z]][i] << endl;
					goto stop;
				}
			}
		}
		cout << 0 << endl;
	stop:;
	}
}