#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

void solve()
{
	int n;
	while (cin >> n, n)
	{
		vector< vector<int> > student(n, vector<int>(n));
		for (int i = 0; i < n; ++i)
		{
			for (int j = 0; j < n; ++j)
			{
				cin >> student[i][j];
			}
		}
		vector<int> minInRow(n);
		for (int i = 0; i < n; ++i)
		{
			int minv = 1e9;
			for (int j = 0; j < n; ++j)
			{
				minv = min(minv, student[i][j]);
			}
			minInRow[i] = minv;
		}
		vector<int> maxInColumn(n);
		for (int j = 0; j < n; ++j)
		{
			int maxv = -1e9;
			for (int i = 0; i < n; ++i)
			{
				maxv = max(maxv, student[i][j]);
			}
			maxInColumn[j] = maxv;
		}
		bool isNotFound = true;
		sort(maxInColumn.begin(), maxInColumn.end());
		for (int i = 0; i < n; ++i)
		{
			for (int j = 0; j < n; ++j)
			{
				if (maxInColumn[i] == minInRow[j])
				{
					cout << maxInColumn[i] << endl;
					goto END;
				}
			}
		}
		if (isNotFound)
		{
			cout << 0 << endl;
		}
END:
		;
	}
}

int main()
{
	solve();
	return(0);
}