import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	while (1) {
		auto n = readln.chomp.to!int;
    if (!n) break;
    auto f = new bool[][](n, n);
    auto a = new int[][](n, n);
    auto b = new int[][](n, n);
    foreach (i; 0..n) {
      a[i] = readln.chomp.split.map!(to!int).array;
      auto m = a[i].reduce!(min);
      foreach (j; 0..n) {
        b[j][i] = a[i][j];
        if (a[i][j] == m) {
          f[i][j] = 1;
        }
      }
    }
    int res;
    foreach (j; 0..n) {
      auto m = b[j].reduce!(max);
      foreach (i; 0..n) {
        if (b[j][i] == m && f[i][j]) {
          res = m;
        }
      }
    }
    res.writeln;
	}
}