#include <iostream>
#define NMAX 100
using namespace std;

int main(){
    int n;
    int input;
    int class_room[NMAX][NMAX];
    int class_room_hand[NMAX][NMAX]; // 1 right 2 left 3 both
    int right[NMAX] = {0};
    int left[NMAX] = {0};
    int ans = 0;
    int ans_n = 0;
    while (cin >> n) {
        if (n == 0) {
            break;
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                cin >> input;
                class_room[i][j] = input;
            }
        }
        for (int i = 0; i < n; i++) {
            right[i] = class_room[i][0];
            for (int j = 0; j < n; j++) {
                if (right[i] > class_room[i][j]) {
                    right[i] = class_room[i][j];
                }
                if (left[i] < class_room[j][i]){
                    left[i] = class_room[j][i];
                }
            }
        }
        
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (right[i] == class_room[i][j]) {
                    class_room_hand[i][j] |= 1;
                }
                if (left[i] == class_room[j][i]){
                    class_room_hand[j][i] |= 2;
                }
            }
        }
        
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (class_room_hand[i][j] == 3) {
                    ans_n++;
                    ans = class_room[i][j];
                }
            }
        }
        if (ans_n >= 1) {
            cout << ans << endl;
        }else{
            cout << 0 << endl;
        }
        ans_n = 0;
        ans = 0;
        fill((int*)class_room,(int*)(class_room+NMAX),0);
        fill((int*)class_room_hand,(int*)(class_room_hand+NMAX),0);
        fill(right, right + (sizeof(right) / sizeof*(right)),0);
        fill(left, left + (sizeof(left) / sizeof*(left)),0);
    }
    return 0;
}