#include <stdio.h>
#include <string.h>
#define REP(i, a, b) for (i=(a); i<(b); ++i)
#define rep(i, n) REP(i, 0, n)
int main(void)
{
	int i, j, n;
	int a[100][100], b[100][100];
	while (scanf("%d", &n), n) {
		memset(b, 0, sizeof(b));
		rep(i, n) rep(j, n) scanf("%d", &a[i][j]);
		rep(i, n) {
			int m = (1 << 30);
			rep(j, n) if (a[i][j] < a[i][m]) m = j;
			rep(j, n) if (a[i][j] == a[i][m]) b[i][j]++;
		}
		rep(j, n) {
			int m = 0;
			rep(i, n) if (a[i][j] > a[m][j]) m = i;
			rep(i, n) if (a[i][j] == a[m][j]) b[i][j]++;
		}
		int res = 0;
		rep(i, n) rep(j, n) if (b[i][j] == 2) res = a[i][j];
		printf("%d\n", res);
	}
	return 0;
}