#include <stdio.h>
#include<math.h>
#include <algorithm>
using namespace std;

int main(){
	int n,row_min;

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		int table[n][n],min_of_row[n],max_of_col[n];

		for(int i = 0; i < n; i++){
			max_of_col[i] = -1;
		}

		for(int i = 0; i < n; i++){
			row_min = 2147483647;
			for(int k=0; k < n; k++){
				scanf("%d",&table[i][k]);
				if(row_min > table[i][k]){
					row_min = table[i][k];
					min_of_row[i] = row_min;
				}
				max_of_col[k] = (max_of_col[k] >= table[i][k])?max_of_col[k]:table[i][k];
			}
		}

		int ans = 0;
		for(int i=0; i < n; i++){
			for(int k=0; k < n; k++){
				if(table[i][k] == min_of_row[i] && table[i][k] == max_of_col[k]){
					ans = table[i][k];
				}
			}
		}
		printf("%d\n",ans);

	}
    return 0;
}